Jenson Button, the 2011 victor, pulled over and out of the race on the 12th lap with his MacLaren's engine in flames. They were followed by Ferrari's Kimi Raikkonen. Vettel and Raikkonen both pitted again after 38 laps.
Ricciardo and team-mate Max Verstappen started fourth and fifth and had entertained thoughts of battling for victory.
Another Toro Rosso driver Carlos Sainz Jr has ended up slowest in Q2 after he clouted the wall of champions at the end of his first proper flying lap, causing the session to be red-flagged while race marshals craned away his broken F1 auto.
The second McLaren-Honda of Jenson Button was fractionally quicker than Alonso in the first two sectors of his final lap in Q2, but he dropped time in the final sector and wound up 12th, blaming a lack of a tow on the run from the hairpin. It comes up trumps nowhere more than here, with plenty of big stops.
But Hamilton blasted by with a 1:12.812 and Rosberg clocked a 1:12.847. Rosberg remained second while Vettel took third and Ricciardo fourth. And so he set the first lap time - a 1:22.859 - as he warmed up his ultra soft tires.
New concealed carry ruling won't affect Arizona
The New York-based gun control organization Everytown welcomed the decision as "a major victory for public safety". There are now more than 270,000 concealed weapons permit holders in Arizona, about 4 percent of state residents.
After crashes, engine problems and eight races without a win, Lewis Hamilton's jubilation was evident as he threw himself into the arms of his Mercedes team after winning Sunday's rainy, incident-packed Monaco Grand Prix.
Indeed in the dry, the championship leader provided Hamilton with the sternest of tests.
Danish driver Kevin Magnussen did not take part in qualifying with Renault unable to fix his auto in time after a crash late in final practice. "Looking at our qualifying performance lately, this was one of our better ones".
Hamilton's mood was in stark contrast to Saturday evening when - after qualifying in third place - he wrote off his chances of victory on a track so hard to overtake on.
Rosberg was edged out by just 0.062s in the pair's opening runs in Q2 but neither could improve on their final lap.
IIT JEE (Advanced) results declared, Jaipur's Aman Bansal tops the exam
More girls qualified this year to join the prestigious Indian Institutes of Technology, but none made it to the top-100 ranks. This year, with the addition of four new IITs , the total number of seats has gone up to 10,575 from last year's 10,006.
"It doesn't matter how far you were ahead, as long as you're ahead", said Hamilton, who will be on the pole in Montreal for the fifth time.
Valtteri Bottas took the 3rd podium position, the Williams team's 1st for Y 2016, with Max Verstappen 4th.
Rosberg now has 116 points to Hamilton's 107 after seven of 21 rounds.
Following Button's retirement, Fernando Alonso was the sole McLaren to finish in P11 despite requesting to retire with a handful of laps to go. That will move the two Haas drivers up a place to 13th and 14th, with Esteban Gutierrez beating team-mate Romain Grosjean by 0.232s.
Marcus Ericsson had a quiet race en route to 15th for Sauber ahead of Kevin Magnussen and Pascal Wehrlein, while Felipe Nasr and Rio Haryanto were the last classified finishers in P18 and P19 respectively.
Solar-powered pilots awed by Statue of Liberty
The average speed is just 30 miles (48 kilometers) per hour, but the speed doubles when it becomes exposed completely to sunlight. Solar Impulse 2 was originally scheduled to arrive in New York Tuesday but the flight was postponed due to bad weather.