Spain moved within one victory of a medal in Olympic men's basketball with a hard-fought 66-59 victory over France in Wednesday's quarterfinals, a contest marred by unsportsmanlike behavior in the closing seconds.

Spain and France showed their mutual respect at the beginning of the game, both clamping down on defense and playing at a deliberate pace, although the Spaniards struggled more than their opponents to get the ball in the net.

France grabbed the early lead with strong play by tempo-setting point guard Tony Parker of the NBA San Antonio Spurs, although Spain stayed within striking distance when Sergio Rodriguez linked up with Rudy Fernandez for an alley-oop to close out the first quarter.

Spain continued to struggle in the second quarter, using a zone defense to minimize the damage on that end of the floor while its sputtering offense failed to connect on outside shots, especially from three-point range.

But the Iberian nation managed to hang in the game and trail by just three points at the half 37-34 as France started to run out of ideas on offense.

The Spaniards came out strong on the glass to get some putbacks at the start of the third quarter and took a 47-37 lead on the strength of two free throws and a rare three pointer by center Marc Gasol.

But France fought back in the latter part of the third quarter and the game stayed close for much of the fourth, with the game completely up for grabs with just three minutes to the final buzzer.

Fernandez hit two free throws to give Spain a 60-57 lead with a minute and a half remaining and contributed to his team's stifling defense on France's next possession, which ended with a shot-clock violation.

Pau Gasol then found brother Marc Gasol with 45 seconds remaining to give Spain a five point lead and virtually wrap up the contest.

France had high hopes after winning four straight games at these Olympics and its frustration at being eliminated from the competition showed at the end, with Ronny Turiaf committing a hard foul on Fernandez and Nicolas Batum then punching shooting guard Juan Carlos Navarro in the arm.

Parker and Boris Diaw led the way for France with 15 points each, while Marc Gasol headed a balanced Spanish attack by notching 14 points. EFE