Wales will play Northern Ireland in the last 16 of Euro 2016, while England take on Iceland and the Republic of Ireland face France.
The Republic were minutes from going out but finished third in Group E with a late 1-0 win over Italy and progress.
Wales, who topped Group B, play Michael O’Neill’s Northern Ireland in Paris on Saturday (17:00 BST) live on BBC One.
England, who were runners-up behind Wales, play surprise Group F runners-up Iceland in Nice on Monday (20:00 BST).
Martin O’Neill’s Republic of Ireland side, who like Northern Ireland qualified as one of four best third-placed teams, take on hosts France in Lyon on Sunday at 14:00 BST.
Neither Northern Ireland nor Wales had ever qualified for the European Championship before this year’s edition, the first to feature 24 teams, while it is the first time the Republic have made the knockout stages of a Euros.
The last time the Republic of Ireland played France was in 2009, when Thierry Henry handled the ball in the build-up to the deciding goal in a World Cup qualification play-off.
With a population of just 330,000, England’s opponents Iceland are the smallest nation ever to qualify for the tournament.
- Late 1-0 win over Italy sends Republic through
- Iceland beat Austria 2-1 with last-minute winner
- No-one will be scared of England – Shearer
- Wales expect ‘physical’ Northern Ireland challenge
Late drama justifies extended tournament
The Republic of Ireland were heading out before a late Robbie Brady header gave them a 1-0 win over Italy and sent them through as another one of the best third-placed teams.
Winger James McClean said the sight of “grown men crying and complete love for our country” was “quite remarkable”, adding: “We knew it would be win or bust, we left nothing on the field, the best night of my life, hands down.”
Goalscorer Brady said he was “absolutely flabbergasted” by the result and described it as an “out of body experience”.
That dramatic climax echoed scenes earlier on Wednesday as Iceland sealed second place in Group F by scoring a last-minute goal to beat Austria 2-1.
That twist left Portugal in third – after their star forward Cristiano Ronaldo criticised Iceland’s “small mentality” earlier in the group stages.
Had the match finished 1-1, England would have faced Portugal in the last 16 instead.
The Portuguese, who now play Group D winners Croatia, knocked England out of the European Championship in 2004 and the World Cup in 2006, both times after a penalty shootout.
BBC commentator John Motson said: “The third-place argument has been laid to rest. Who would have thought when we started this adventure that England, Northern Ireland, Wales and the Republic of Ireland would all be in the last 16?”
The full draw
All times BST
Switzerland v Poland (Saturday 14:00 on BBC)
Wales v Northern Ireland (Saturday 17:00 on BBC)
Croatia v Portugal (Saturday 20:00 on ITV)
France v Republic of Ireland (Sunday 14:00 on ITV)
Germany v Slovakia (Sunday 17:00 on ITV)
Hungary v Belgium (Sunday 20:00 on BBC)
Italy v Spain (Monday 17:00 on BBC)
England v Iceland (Monday 20:00 on ITV)
Former Republic of Ireland international Kevin Kilbane on BBC Radio 5 live: “It does not get any better than this. We wanted this, we were desperate for this – I fancied our chances.
“It is amazing. I am so happy for Martin O’Neill, the staff and the supporters. They have done us all proud. This is incredible.”
The draw means at least one of the home nations will definitely make the quarter-finals and Northern Ireland manager Michael O’Neill described facing Wales as a “fantastic game”.
He told BBC Sport: “We will be heading back to the Parc des Princes which as we know from Tuesday night is a brilliant stadium. We will benefit from the familiarity of having been there already, of having done the journey and of having played on the pitch.
“The results tonight put us in what is arguably the more favourable side of the draw, so we are pleased about that.”
- Portugal forward Ronaldo became the first player to score at four different Euros when he netted against Hungary.
- This year’s final is already guaranteed to feature a nation that has never won a major tournament.
- England averaged 60.5% possession in the group stages; Iceland’s was 29.0%.
- Victory over Italy was the Republic of Ireland’s first Euros win since beating England in their first ever game at the finals in 1988.
- Wales and Hungary scored more goals than any other team (six) in the group stages.
- 69 goals have been scored so far, a rate of 1.92 per game, the lowest average for a Euro group phase 1992 (1.75).
- 27.5% of the goals came from the 80th minute onwards (19).
- This is the first time since 1996 that no team won all three of their group games.
Harder side of the draw for England
Teams now potentially in England’s path have won 19 major international trophies – compared with none in the other side of the draw, where Wales, as Group B winners, sit.
Hodgson said England are “not frightened of anybody” but they have been drawn alongside previous World Cup winners and European champions Spain, Italy, Germany and France.
The most successful teams in the top half of the draw are Hungary – with two World Cup runners-up medals – and Belgium and Portugal, who have both been runners-up once in the European Championship.
Who is out?
Albania’s players were rewarded with diplomatic passports after a 1-0 win over Romania gave them hope of progressing as one of the best third-placed teams, but missed out on goal difference.
Romania, denied a point against France in the tournament’s opening match by a late Dimitri Payet strike, finished bottom of Group A.
Russia’s players were widely criticised in the nation’s media after finishing bottom of Group B with just one point, despite holding England to a draw with a late goal of their own. Manager Leonid Slutsky has offered his resignation.
Ukraine were the only side to fail to score and exit without a point, the 2-0 defeat by Northern Ireland ultimately proving enough for O’Neill’s side to progress.
Sweden finished bottom of Group E after defeat by Belgium on Wednesday, prompting striker Zlatan Ibrahimovic’s retirement.
Turkey’s 2-0 victory over the Czech Republic gave them hope of making the knockout stage as one of the best third-placed teams, but they were denied by the Republic of Ireland’s winner against Italy.
The Czechs finished bottom in Group D, while Austria scored just one goal in their three games to finish bottom of Group F.
Who would make it into your starting XI of the tournament so far?
The group stage is over at Euro 2016 – but who were the best players? Pick your group stage XI using our team selector.
Create leagues and play against your friends in BBC Sport’s new Euro 2016 Predictor game