France scored two late goals Tuesday to give the 1998 champions a spot in the World Cup quarterfinals with a 3-1 win over Spain.

David Villa had scored from the penalty spot in the 27th minute to give Spain the lead before Franck Ribery ran around goalkeeper Iker Casillas to equalize with a left-foot shot in the 41st.

Patrick Vieira made it 2-1 in the 83rd minute and Zinedine Zidane scored the third in injury time.

France will face Brazil in the quarterfinals on Saturday in Frankfurt. Brazil beat Ghana 3-0 earlier Tuesday.

Zidane, who will retire after the World Cup ends, took the free kick which made the difference.

His shot curled into the goalmouth, where a frantic Xabi Alonso headed it into the path of Vieira, who then headed it into the net off a deflection.

France defender Lilian Thuram conceded the early penalty with a push from behind on defender Pablo Ibanez. Villa's goal was his third of the tournament.

The game turned France's way in the 41st. Vieira sent Frank Ribery into open space and the Marseille winger swept the ball past Casillas with his right foot and slotted it home with his left, just ahead of two onrushing defenders.

There would always be an edge to this old rivalry between neighbors, but the relentless whistling of the Marseillaisse by thousands of Spanish fans upped the ante even more.

France had never lost a competitive match to Spain and Tuesday marked the 22nd anniversary of its 2-0 defeat of Spain to win the 1984 European Championship.

Brazil advanced past newcomer Ghana with three streaking goals Tuesday, the first an early flash by Ronaldo that made him the most prolific scorer in World Cup history.

Ronaldo netted his 15th World Cup goal in the fifth minute — passing German Gerd Mueller to become the tournament's all-time leading scorer — and Adriano and Ze Roberto added one each to give Brazil the 3-0 win.

Ghana made Brazil work for its 11th straight World Cup win, challenging the five-time champions and outplaying them at times, but their shots were either right at goalkeeper Dida or off the mark.

The result secured Brazil in the quarterfinals for the fourth straight time. The last time it was eliminated in the second round was in 1990 in Italy, when it lost to archrival Argentina.

For full World Cup coverage, go to FOXSports.com.