It was the first real direct comparison of the weekend after both teams ran the soft Pirelli tyres. Mercedes had stuck with the medium in FP1, whereas Ferrari had used only the softer rubber.
Raikkonen set his 1m 24.176s first and might have improved on that but for a fuel system problem. Rosberg then lapped in 1m 23.922s to go to the top of the timesheets.
Hamilton had earlier set the pace on the medium tyres, but his lap on softs came up short by 0.719s after he lost half a second in the final sector behind Felipe Nasr’s Sauber.
Vettel was a subdued fourth in the second Ferrari, on 1m 25.017s, and had local hero Carlos Sainz on his tail with 1m 25.131s. The Toro Rosso driver had a point to prove after former team mate Max Verstappen was plucked away to join Daniel Ricciardo at Red Bull, and beat both of them and new team mate Daniil Kvyat as he took fifth place.
Ricciardo got closest to him with 1m 25.194s, while Verstappen impressed with 1m 25.375s which left him eighth. Kvyat, however, struggled to 15th place with 1m 26.375s.
It was Fernando Alonso in the fast-improving McLaren who split the Red Bulls, with 1m 25.342s, as Sergio Perez headed Force India team mate Nico Hulkenberg to complete the top 10. The Mexican lapped in 1m 25.437s, the German in 1m 25.453s.
It was a difficult afternoon for Williams with Valtteri Bottas 11th and Felipe Massa only 16th, and for Reanult's Jolyon Palmer. Having missed FP1 as Esteban Ocon took over his car but met trouble, Palmer then had a left-rear tyre deflate on the main straight soon after the session began.
The virtual safety car was deployed, before the session was red flagged for eight minutes as the R.S.16 and its debris were cleared away. Later Palmer got going in the final 20 minutes, improving to 1m 26.770s and 17th place, half a second down on team mate Kevin Magnussen.
Jenson Button was another late improver, to 12th, after his Honda engine shut down early on as he came into the pits. As Sauber and Haas struggled, the improved Manors of Pascal Wehrlein and Rio Haryanto were 18th and 19th.
WATCH: The best of Friday's action from Barcelona
Unfortunately, we are unable to play the video at this time.
Error Code: UNKNOWN
0:00 / 0:00