Lewis Hamilton was beaten in qualifying for the first time this season as Mercedes team-mate Nico Rosberg took pole position in Spain.
Rosberg beat Hamilton by 0.267 seconds, with Ferrari's Sebastian Vettel third ahead of Williams' Valtteri Bottas.
The Spanish fans who flock to salute their hero Fernando Alonso had another name to cheer as Toro Rosso's Carlos Sainz Jr took a superb fifth.
Sainz's team-mate Max Verstappen was sixth as McLaren's Alonso was 13th.
Both McLarens made it into the second part of qualifying for the first time this season, another step forward for the team in their first season with new engine supplier Honda.
Alonso beat team-mate Jenson Button, for the first time this season in a session in which they have both competed, by 0.096secs and one place.
Ferrari's Kimi Raikkonen had a disappointing session, managing only seventh place, ahead of Red Bull's Daniil Kvyat, Williams' Felipe Massa and the second Red Bull of Daniel Ricciardo.
Rosberg headed into this weekend knowing he needed to beat Hamilton as he bids to get his championship campaign on track.
Hamilton has a 27-point advantage over Rosberg, with Vettel a further point adrift, heading into this race after three wins and a second place in the first four races of the season.
In beautiful Spanish spring sunshine, Rosberg has looked competitive all weekend, and he took the initiative by going fastest in second qualifying and then repeating the feat on the first runs in the top 10 shoot-out.
Hamilton asked for a balance change before his last lap but none of the front-runners improved on their final runs.
Rosberg said: "Of course I needed it sooner rather than later. It is one step in the right direction to winning the race. It was a good day in the office."
Hamilton said: "I just generally didn't have the pace today. Nico did a great job and I don't think I had the balance quite where I like it - tomorrow there is still a lot to play for."
At the back, Englishman Will Stevens again out-qualified his Spanish team-mate Roberto Mehri by 0.838secs.