LILLE, France (AP) — Ireland's never-say-die mentality has finally paid off.

Even when another early exit from a European Championship seemed unavoidable, Ireland refused to concede.

A late goal from Robbie Brady was enough for Ireland to beat a reshuffled Italy side 1-0 on Wednesday and advance to the knockout stages for the first time as one of the best third-place teams.

"It was very special. I am thrilled, it was a great win," Ireland coach Martin O'Neill said. "We deserved to win. We played some phenomenal stuff. There wasn't a player in the Irish shirt that didn't play heroically."

Ireland's reward is a match against France in Lyon on Sunday that will surely resonate for Ireland's passionate fans as it will revive memories of the last time the two sides met in November 2009, in a two-legged playoff for the following year's World Cup.

The aggregate score was 1-1 when the return match went into extra time at Stade de France. In a notorious incident, France striker Thierry Henry used his left arm and hand to control the ball and then pass to William Gallas who scored the decisive goal.

Italy, which was already assured of top spot in Group E after two straight wins, will meet defending champion Spain next at the Stade de France on Monday in what is potentially the most mouth-watering match of the round of 16.

Brady's 85th minute goal was just reward for an inspired performance by the Ireland team, which needed to win to get through to the next round. His goal capped a period of intense Irish pressure that also saw Wes Hoolahan miss a golden chance to put Ireland ahead.

"It's a proud night for myself and fantastic for the team," Brady said. "The lads worked their socks off today. It was the perfect timing for a goal."

Spurred on by its passionate green-clad fans, Ireland tried to drag the Italians into a physical battle from the opening whistle. In the first few minutes, there were some crunching tackles, most notably when Jeff Hendrick hit Alessandro Florenzi with a flying tackle.

Weakened by the absence of injured striker Jon Walters, Ireland missed two clear chances to take the lead in the first half. Hendrick sent a 20-meter shot just wide and Daryl Murphy saw his header off a corner saved by goalkeeper Salvatore Sirigu. Italy's only first-half attempt came two minutes before halftime when Ciro Immobile's 20-meter curler went wide.

While Ireland strived for a winner, Italy found some fluency in the second half. Simone Zaza went close with a powerful volley that went just over the cross bar, and substitute Lorenzo Insigne hit the far post with a curling low shot from outside the area.

"We conceded the goal just as we seemed to take control of the game," Insigne said. "The result is a shame but in the end they deserved it."

Ahead of the next round, Italy coach Antonio Conte had left eight regular starters out of his lineup, including goalkeeper Gianluigi Buffon, who has been suffering from a fever over the last few days. Only defenders Andrea Barzagli and Leonardo Bonucci as well as midfielder Alessandro Florenzi started in Italy's previous game against Sweden.

"We conceded when we were on top," Conte said through an interpreter. "It was a very physical match on a barely playable pitch. The pitch did punish us a bit more than them."

The pitch at the Stade Pierre Mauroy is to be re-laid over the coming days, largely because of the impact of the recent heavy rain.

Regardless of the state of the pitch and the strength of the Italian side, Ireland's victory is one of its most notable.

"We are not going to give up here," Brady said. "We've managed to beat some of the best teams in the world. If we click together, we can beat anyone."