Valentino Rossi led a Yamaha one-two in Friday practice for the Catalunya Grand Prix.
The world champion had sat in second behind his team-mate Jorge Lorenzo for most of the hour, but produced a 1m43.038s lap with five minutes to go to beat the Spaniard.
That put Rossi half a second clear, and although Lorenzo reduced the gap by two tenths, he had to settle for second.
The result will be a boost for Rossi after a difficult month that saw him crash at Le Mans and then only finish third at Mugello - ending a seven-year winning streak at his home track.
Casey Stoner took third for Ducati, despite having to switch to his spare bike following a fall at the hairpin at the end of the back straight. But the more significant result for the team was Nicky Hayden's encouraging sixth place on the second Ducati - his most competitive performance of the season so far.
The two Ducatis were split by Honda's Andrea Dovizioso and LCR Honda's Randy de Puniet, the latter showing his usual strong Barcelona form.
Loris Capirossi was the fastest Suzuki rider in seventh, ahead of Tech 3 Yamaha's Colin Edwards.
Dani Pedrosa took a tenative 14th on the second factory Honda as he nursed his injured hip, while his compatriot Sete Gibernau was 12th for Hernando Ducati as he returned after the collarbone breakage that forced him to miss Mugello.
Unsurprisingly given that his first taste of the bike came during the session, Scot Honda's new recruit Gabor Talmacsi was slowest of all. Amid rumours that Talmacsi will soon become the team's sole rider, his current team-mate Yuki Takahashi showed he will not relinquish the seat without a fight by taking ninth.
Pos Rider Bike Time Gap
1. Valentino Rossi Yamaha 1m43.038s
2. Jorge Lorenzo Yamaha 1m43.340s + 0.302s
3. Casey Stoner Ducati 1m43.636s + 0.598s
4. Andrea Dovizioso Honda 1m43.684s + 0.646s
5. Randy de Puniet LCR Honda 1m43.871s + 0.833s
6. Nicky Hayden Ducati 1m44.152s + 1.114s
7. Loris Capirossi Suzuki 1m44.340s + 1.302s
8. Colin Edwards Tech 3 Yamaha 1m44.419s + 1.381s
9. Yuki Takahashi Scot Honda 1m44.484s + 1.446s
10. James Toseland Tech 3 Yamaha 1m44.580s + 1.542s
11. Marco Melandri Hayate Kawasaki 1m44.649s + 1.611s
12. Sete Gibernau Hernando Ducati 1m44.678s + 1.640s
13. Chris Vermeulen Suzuki 1m44.744s + 1.706s
14. Dani Pedrosa Honda 1m45.043s + 2.005s
15. Toni Elias Gresini Honda 1m45.101s + 2.063s
16. Alex de Angelis Gresini Honda 1m45.126s + 2.088s
17. Mika Kallio Pramac Ducati 1m45.394s + 2.356s
18. Niccolo Canepa Pramac Ducati 1m45.454s + 2.416s
19. Gabor Talmacsi Scot Honda 1m47.654s + 4.616s