Nico Rosberg will start tomorrow afternoon's Bahrain grand prix on pole in his Mercedes, with team-mate Lewis Hamilton in the second slot.
Ricciardo (Red Bull) qualified third followed by Bottas (Williams), Perez (Force India), Raikkonen (Ferrari), Button (McLaren), Massa (Williams), Magnussen (McLaren) and Alonso (Ferrari).
Sebastian Vettel qualified 11th.
Ricciardo, however, has a 10-point penalty following pit-stop problems in the last race, and will start 13th.