Two goals from Thierry Henry helped defending champions France book a quarter-final clash with Greece as Switzerland ended their tournament with just a point to their name.
Switzerland had battled the French for most of the match until Henry hit two well-taken goals to give the France what should be an easier last-eight match.
Zinedine Zidane had put the French ahead after 26 minutes when he headed home Robert Pires corner.
But only six minutes later Johann Vonlanthen equalised for the Swiss, becoming the youngest-ever goal scorer in a final tournament of the European Championship.
The French were looking visibly nervous until Henry's two late goals ensured they will finish ahead of England in Group B.
Now Sven-Goran Eriksson's side must face tournament hosts Portugal while the French face a Greek team that has never gone this far in a major tournament before.
The French started quickly and in the opening minutes Henry's cross found David Trezeguet whose shot was deflected behind for a corner.
Next Henry outpaced Stephane Henchoz but his cross was gathered by Jorg Stiel.
Pires launched the next French offensive with a nice run and diagonal pass that gave Zidane a shooting chance but he totally miscued his shot to the laughter of the Swiss supporters.
But then a sweeping Swiss move saw Gygax swing in a dangerous ball to the near post where Hakan Yakin fired just wide.
Yakin tried his luck again when the Swiss won a free-kick but Fabien Barthez made a fine save at the expense of a corner.
The French hit back and Lizarazu then surged towards the Swiss goal but his shot was saved by Stiel.
But the champions breathed a sigh of relief when Hakan Yakin tripped over the ball with the goal beckoning.
Then the French won a free-kick when Wicky was penalised for a challenge on Zidane but Henry's free-kick was deflected over the bar by the wall.
But from the resulting corner France took the lead with Zidane's third goal of the tournament as he headed in from Pires' delivery in the 20th minute.
France were visibly lifted and Pires took another corner which was volleyed by Lizarazu only for a Swiss body to get in the way.
Zidane surged down the right but his cross eluded Henry and Trezeguet before Patrick Vieira floated in a ball for Henry who headed over.
Just as it looked as though France might overrun the Swiss the Alpine nation hit back with their first goal of the tournament.
Cabanas surged down the middle and fed Vonlanthen who beat Barthez with a diagonal shot.
That saw the teenage PSV Eindhoven man beat the record set last week by Wayne Rooney as the youngest goalscorer in the finals of the European Championship.
France tried to respond and Henry released Trezeguet who was onside but Stiel dashed out of his area to clear the danger.
A fine sweeping Swiss move ended with Lilian Thuram making a saving header from Hakan Yakin but inexplicably Slovakian referee Lubos Michel gave a goal-kick.
Cabanas became the first man cautioned for a tug at the shirt of Pires.
Zidane then teed up Henry who headed wide with the goal beckoning in the last real chance of the half.
Santini brought on William Gallas at half-time with the Chelsea player replacing Willy Sagnol.
Henry was then booked for an apparent dive on the edge of the Swiss penalty area.
At the other end Silvestre got in a saving header from a dangerous cross by Wicky.
Trezeguet failed to get on the end of a dangerous cross from Henry as the game continued to ebb and flow.
Switzerland brought off their playmaker Hakan Yakin, bringing on Benjamin Huggel while Pires fired a shot over the bar from the corner of the Swiss penalty area.
Zidane and Lizarazu worked a fine move down the left but once again the ball just missed Trezeguet's head before Wicky picked up a yellow card for a foul on Gallas. Huggel also earned a yellow card that will rule him out of his country's next game.
Santini made another change, bringing on Manchester United striker Louis Saha.
And almost immediately the French scored their second goal.
Slack defending from the Swiss allowed Henry to latch onto the ball and the Arsenal forward steered the ball past Stiel into the goalkeeper's right hand corner.
Henry and his team-mates ran to the bench to celebrate the goal that would mean they will next play Greece rather than the hosts Portugal.
Zidane curled a free-kick just over the bar with the French determined to kill off the game. And Pires crossed towards Henry whose header was well saved by Stiel.
And then came the goal that ended the contest. In the 84th minute Henry surged down the left, cut inside his marker and scored at the near post with his right foot.
Teams
Switzerland Stiel, Henchoz (Magnin 85), Murat Yakin, Muller,
Spycher, Cabanas, Vogel, Wicky, Gygax (Rama 85),
Hakan Yakin (Huggel 60), Vonlanthen.
Subs Not Used: Zuberbuhler, Roth, Berner, Chapuisat, Zwyssig,
Celestini, Barnetta.
Booked: Hakan Yakin, Wicky, Huggel.
Goals: Vonlanthen 26.
France Barthez, Sagnol (Gallas 45), Thuram, Silvestre,
Lizarazu, Makelele, Vieira, Zidane, Pires, Trezeguet (Saha 75),
Henry, Gallas (Boumsong 90).
Subs Not Used: Coupet, Dacourt, Desailly, Govou, Landreau,
Marlet, Pedretti, Rothen, Wiltord.
Booked: Henry.
Goals: Zidane 20, Henry 76, 84.
Att: 30,000
Ref: Lubos Michel (Slovakia).