Contador had attacked early on the six kilometre finishing climb of the Peña del Águila, quickly opening a gap over a chasing group of Pinot and the Team Sky trio of Wout Poels, Diego Rosa, and Mikel Landa as race leader Alejandro Valverde (Movistar) seemed to be in trouble behind.
But while Contador had gone for broke, Pinot and Valverde were pacing themselves well, and while Valverde was able to ride his way back across to the small chasing group to limit his losses to seven seconds, Pinot had bigger aspirations.
The Frenchman rode away from the Team Sky riders, and as the climb flattened out in the final kilometre he had Contador in his sights.
It was an agonising wait as Pinot clawed his way across the final few bike lengths to reach Contador's back wheel, where he waited for just a second before launching a stinging attack to win the stage for a few bike lengths.
Despite missing out on the stage win, Contador gained enough time on Valverde to move into the leader's jersey, while Pinot moved up to second.
The queen stage of the Ruta del Sol saw a five man breakaway group escape early. Tim Wellens (Lotto-Soudal) was the first to go on the attack, being joined by Antonio Nibali (Bahrain Merida), Georg Preidler (Team Sunweb), Felix Grosschartner (CCC Sprandi Polkowice), and Xandro Meurisse (Wanty-Groupe Gobert).
The group worked well together, building up a gap of more than eight minutes to the peloton with 100km gone of the 177.9km stage.
Trek-Segafredo, Team Sky, and Movistar all shared chase duties, and as the gap began to fall in the second half of the stage, Wellens went on the attack from the break, first dragging Grosschartner with him, and then going solo on the ramps of the second category Puerto de las 7 Pilillas climb with 50km remaining.
At that point the Belgian had an advantage of more than six minutes, looking smooth and comfortable as he looked to pick up his second victory of the season in a similar manner to his first.
However Wellens's progress was not all smooth, as he lost grip on his back wheel at a roundabout with just over 30km to go, hitting the deck before leaping back on his bike only a little road rash to show for it.
The same roundabout caused problems in the peloton as a number of riders also crashed, although the main contenders at the front of the group were unaffected.
Much of the final 30km was uphill, and with Trek-Segafredo and Team Sky sitting on the front of the peloton Wellens's advantage steadily fell, dropping below two minutes for the first time on the penultimate climb of the day with 15km to go.
By the time Wellens reached the bottom of the final climb, the Belgian was within sight of the Vasil Kiriyenka-led peloton, throwing in the towel as the road narrowed and ramped up.
The first attack of the climb came from Warren Barguil (Team Sunweb), briefly opening a gap before being pulled back into the fold by Team Sky's Mikel Nieve, before a counter-attack from Nieve's team-mate Mikel Landa.
The Spaniard quickly established a 15 second gap before settling into a rhythm on the nine per cent gradients. Landa looked smooth, but hardwork from Trek-Segafredo's Fabio Felline clawed Contador back into contention.
And as soon as Felline peeled off with 2.5km to go, Contador's attack came, jumping over the top of Landa and dropping all of the other race contenders.
The attack caused chaos behind, with a Thibaut Pinot leading the chase ahead of the Team Sky trio of Poels, Landa, and Diego as race leader Alejandro Valverde was unexpectedly dropped with Ion Izagirre (Bahrain-Merida), quickly conceding 25 seconds to Contador.
But as the gradient flattened out near the top of the climb, Pinot managed to grab on to the coat tails of Contador, with the Frenchman catching his breath for a second, before coming over the top of the Spaniard to win the stage by a comfortable margin.
Behind, Valverde had paced himself perfectly on the steep slopes, joining up with Rosa and Landa, before finding a final burst of speed to come home third, only seven seconds down on Pinot.
Tomorrow's 12 kilometre time trial looks like the last chance for riders to shake up the top of the general classification, with two flat finishes stages four and five.
Ruta del Sol stage two, Torredonjimeno - Alto Peña del Águila, Mancha Real (Jaén), (177.9km):
1. Thibaut Pinot (Fra) FDJ, in 4-44-03
2. Alberto Contador (Esp) Trek-Segafredo at 2 seconds
3. Alejandro Valverde (Esp) Movistar Team at 7s
4. Ion Izaguirre (Esp) Bahrain-Merida, same time
5. Mikel Landa (Esp) Team Sky, at 9s
6. Diego Rosa (Ita) Team Sky, st
7. Wout Poels (Ned) Team Sky, at 13s
8. Sébastien Reichenbach (Sui) FDJ, at 28s
9. Pieter Weening (Ned) Roompot - Nederlandse Loterij at 46s
10. Floris De Tier (Bel) Team LottoNl-Jumbo, st
Overall classification after stage two
1. Alberto Contador (Esp) Trek-Segafredo, in 8-46-33
2 Thibaut Pinot (Fra) FDJ, at 3s
3 Alejandro Valverde (Esp) Movistar Team, at 5s
4 Jon Izaguirre (Esp) Bahrain-Merida, st
5 Diego Rosa (Ita) Team Sky, at 7s
6 Wout Poels (Ned) Team Sky, at 11s
7 Mikel Landa (Esp) Team Sky, at 12s
8 Sébastien Reichenbach (Sui) FDJ, at 26s
9 Rigoberto Uran (Col) Cannondale-Drapac, at 49s
10 Pieter Weening (Ned) Roompot - Nederlandse Loterij at 1-08
Thank you for reading 10 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1
Henry Robertshaw began his time at Cycling Weekly working with the tech team, writing reviews, buying guides and appearing in videos advising on how to dress for the seasons. He later moved over to the news team, where his work focused on the professional peloton as well as legislation and provision for cycling. He's since moved his career in a new direction, with a role at the Department for Environment, Food and Rural Affairs.
Power vs aerodynamics: what is the best balance and how can I achieve it?
Watts and aerodynamics are two cornerstones of our cycling performance - but favoring only one will see you going slower than a more balanced approach. Here’s our guide to better optimising your speed
By Andy Turner • Published
Even Wout van Aert can lose his nerve: Five things we learned from the CX World Championships
Even with the absence of Tom Pidcock on the world stage, British cyclo-cross is in a good place
By Tom Thewlis • Published
An ode to Thibaut Pinot, the man who taught us to feel
The 32-year-old will retire at the end of this season, calling time on a career of highs and lows
By Tom Davidson • Published
The dog days aren't over at the Tour de France 2022: Canine chaos AND cuteness
‘Suddenly that beast crossed the street and I couldn’t go anywhere’ - stray dog causes Yves Lampaert to crash on stage 12
By Tom Thewlis • Published
Thibaut Pinot wins Tour de Suisse stage seven as Sergio Higuita takes the overall lead
The Frenchman secured his second win of the year
By Pete Trifunovic • Last updated
'An unforgettable day' — Thibaut Pinot back winning after 1,007 days
The Frenchman won stage five of the Tour of the Alps to end his drought
By Adam Becket • Published
'I could have turned that s***ty page' — Thibaut Pinot emotional after missing out on first win in three years
Frenchman beaten by Miguel Àngel Lòpez at Tour of the Alps after being caught in final kilometre
By Adam Becket • Last updated
Ineos Grenadiers' Magnus Sheffield takes first professional victory with stage three win at Ruta del Sol
The 19-year-old secured his first pro win in just his ninth start for Ineos Grenadiers
By Ryan Dabbs • Published
Alessandro Covi wins stage two of Ruta del Sol with late attack
The UAE Team Emirates rider left the rest of the bunch behind on a cobbled finish in Andalucia.
By Pete Trifunovic • Published
Rune Herregodts secures surprise breakaway victory at the Ruta del Sol 2022
The Belgian held off the breakaway to move into the overall lead of the Andalucian stage race
By Pete Trifunovic • Published