Verstappen led the way for almost the entire weekend, leading every session bar Q1 on the way to the top-10 shootout, and the Dutchman took provisional pole after the first runs with a healthy 0.185-second margin while Ricciardo languished almost 0.3 seconds further down the order.
But the Australian blitzed his final lap, breaking the track record with a time of 1 minute 14.759 seconds to edge Verstappen by just 0.026 seconds.
“I knew it was there somewhere,” Ricciardo said, beaming. “We hadn’t had the cleanest run through practice, and I just knew putting the lap together would be crucial, as always.
“I knew the pace was in the car – Max showed that all weekend – I just knew it was putting together a clean lap at the end.
“I’ve gotta relax a little. I’m tripping major nutsack right now!”
It was Ricciardo first pole position outside Monaco and Red Bull Racing’s first front-row lockout since the 2013 United States Grand Prix almost five years ago.
Verstappen cut a markedly less enthusiastic figure after the session. The Dutchman had the opportunity to become the youngest ever polesitter in Formula One, but he blamed engine problems for depriving him of the record.
“The whole qualifying was crap,” he lamented “Again, same [engine] problems we had in practice two – engine braking not like I want to, rear locking the car.
“We tried to make the best of it. I thought it was going to be enough with the problems we had, but it’s still good to be second.”
The euphoria at Red Bull Racing was almost enough to overshadow Lewis Hamilton qualifying third, which will be enough to win him his fifth world title if he holds that position to the end of the race.
The Briton hailed his team for turning around his car after a deeply uncompetitive showing during Friday practice.
“I’m really, really happy with it,” he said. “Honestly, we had a difficult day yesterday and it was a big improvement today.
“Yesterday we were much further back and we weren’t expecting to be as high as we got. That’s as good as I could get.
“Third place is a nice place to start here. You get a good tow from the guys up ahead – I’m going to be fighting to a least gain a position.”
Sebastian Vettel qualified fourth, setting up a championship duel into the first turn with Hamilton. Mercedes’s Valtteri Bottas and Ferrari’s Kimi Raikkonen backed up the frontrunners in fifth and sixth.
Renault teammates Nico Hulkenberg and Carlos Sainz qualified seventh and eighth ahead of Sauber duo Charles Leclerc and Marcus Ericsson in ninth and 10th.
The top three teams locked out the top six places on ultrasoft tyres – thereby setting the more durable tyre, rather than the pink-striped hypersoft, as their race-start tyre – leaving just four Q3 spots for the midfield to occupy.
The rest of the closely contested midfield was forced to use the delicate hypersoft tyre, which is forecast to last just a handful of laps at the start of the race and therefore be a strategic disadvantage.
With this in mind Force India sent both drivers out on the ultrasoft tyre, not to qualify for Q3 but to ensure Esteban Ocon and Sergio Perez would qualifying just outside the top 10 and have free tyre choice for the race.
It worked for Ocon, who knocked himself out in 11th, but Sergio Perez was dropped to 13th with a scrappy lap behind McLaren’s Fernando Alonso.
Toro Rosso’s Brendon Hartley qualified 14th after making a mistake in the final sector, but teammate Pierre Gasly, who finished 15th didn’t set a lap knowing a 20-place grid penalty for unscheduled engine and gearbox changes will drop him to the back of the grid anyway.
After rain cleaned the circuit of all its grip overnight, the circuit improved rapidly through the first segment of qualifying, with lap times tumbling as the 18-minute session wore on.
It meant the battle to avoid elimination came to a head after the chequered flag, with the entire midfield taking to the track at once in a bid to make it through to Q2.
For Fernando Alonso his final flying lap was particularly important — the Spaniard had had his first time deleted by the stewards for exceeding track limits, which he blamed on his McLaren team for sending him out too close behind teammate Stoffel Vandoorne.
But Alonso’s second lap was centimetre perfect, vaulting him out of the bottom five and sending both Williams drivers to the bottom of the time sheet, where Lance Stroll and Sergey Sirotkin remained in 19th and 20th.
Kevin Magnussen couldn’t improve his time for Haas, anchoring him to 18th.
Sauber’s Charles Leclerc, star of practice earlier on Saturday morning, was next to cross the line, putting himself into the top 15 but ending Vandoorne afternoon in 17th in the process.
Marcus Ericsson followed in the second Sauber, knocking Romain Grosjean in the second Haas into 16th and early elimination.
All five will move up one place once Toro Rosso’s Pierre Gasly is sent to the back of the grid with a 20-place grid penalty for unscheduled engine and gearbox changes.