Stage 12 of the 2012 Giro d'Italia was contested on 17 May, and the race concluded with Stage 21 on 27 May. The second half of the race was situated entirely within Italy; starting with a medium mountain stage from Seravezza to Sestri Levante, before the customary race-concluding time trial was held in Milan.
Following his victory in the tenth stage, 's Joaquim Rodríguez held the lead into the second half of the race. He maintained his lead on stage 12 – after the breakaway succeeded in staying away until the end of the stage as rider Lars Bak held on to win by eleven seconds ahead of the remnants of the breakaway group – and on stage 13, as Mark Cavendish picked up his third stage victory of the race on one of the few sprinter-suited stages during the second half of the race. Rodríguez gave up the lead of the race at the end of stage 14, after rider Ryder Hesjedal attacked on the climb to the stage finish at Cervinia – the first that the climb had featured in the Giro since 1997 – taking 26 seconds out of his rival, and reclaimed the maglia rosa that he held for three days in the first half of the race.
Rodríguez immediately retook the lead of the race the following day at the summit finish at the Pian dei Resinelli. Although he finished second to rider Matteo Rabottini on the day, Rodríguez gained 39 seconds on Hesjedal through his late-stage attack. After the race's second rest day which came after that stage, the gap between Rodríguez and Hesjedal remained at the half-minute mark for the next three stages; the breakaway succeeded once again on stage 16 as rider Jon Izagirre soloed away from a group of riders in the closing stages, while on stage 17, Rodríguez won the stage after a group of the leading overall contenders escaped on the Passo Giau. Also among that group were Hesjedal, former winners Ivan Basso () and Michele Scarponi (), with rider Rigoberto Urán and 's Domenico Pozzovivo making up the sextet. Stage 18 saw the sprinters' last chance of victory with Andrea Guardini of edging out Cavendish for victory.
Hesjedal and Rodríguez took near-identical gaps out on one another during stages 19 and 20; Hesjedal reduced the lead to 17 seconds in the former stage finishing at the Alpe di Pampeago, while Rodríguez moved it back out to 31 seconds following the Cima Coppi finish at the Stelvio Pass. rider Thomas De Gendt moved into overall podium contention by winning the stage to the Stelvio, taking between three and five minutes from all of the other overall contenders, and moved from ninth place to fourth place at the end of the stage. Hesjedal's better time trial abilities enabled him to take the lead of the race on the final day from Rodríguez; he overturned the 31-second deficit, and ultimately became the first Canadian rider to win a Grand Tour. Hesjedal had turned the deficit into a 16-second margin of victory, the closest such margin since Eddy Merckx beat Gianbattista Baronchelli by 12 seconds in the 1974 edition of the race. De Gendt moved ahead of Scarponi for third place, to become the first Belgian rider to finish on a Grand Tour podium since Johan Bruyneel finished third at the 1995 Vuelta a España.
LegendJerseys appearing in the table on the left of the page indicate those worn by the cyclist during the particular stage, while those appearing in the table on the right of the page indicate those awarded to the cyclist after the stage. Denotes the leader of the General classification Denotes the leader of the Mountains classification Denotes the leader of the Points classification Denotes the leader of the Young rider classification s.t. indicates that the rider crossed the finish line in the same group as the one receiving the time above him, and was therefore credited with the same finishing time.
Stage 12 17 May 2012 — Seravezza to Sestri Levante,
The stage had been scheduled to be held over a distance of , but in April 2012, prior to the start of the Giro, the itinerary was changed slightly to . Due to torrential rains which caused floods and mudslides in October 2011, the roads through the Cinque Terre were considered unusable for the race. As such, the second half of the race began with an undulating stage along the Ligurian coast, with four categorised climbs over the parcours, the last of which coming just from the stage finish in Sestri Levante. Mini-attacks set the course for the stage as the field remained as one, for much of the first hour of racing; it was not until after that the stage's primary breakaway had been formed. An initial move of seven riders representing seven different teams went clear, with the septet later joined by two more riders, Jackson Rodríguez () and 's Martijn Keizer, the latter again making it into the breakaway move.
's Sandy Casar was the best-placed of the nine riders in the group, trailing overnight leader Joaquim Rodríguez () by four minutes, and as the stage wore on, became more of a threat to Rodríguez's lead. The breakaway's gap surpassed that figure, reaching a high of seven minutes, with remaining on the stage. As set the pace on the front of the peloton, rider Michał Gołaś soloed off the front of the lead group, but he was caught prior to the summit of the day's final climb, the Villa Tassani. More attacks occurred between the leaders prior to the finish, but Lars Bak produced the decisive attack with remaining, and eventually went clear to an 11-second winning margin at the finish, winning his first individual Giro stage. Casar led a group of six riders across in second, but his time gap to the peloton was only 3' 23". Despite the twelve bonus seconds on offer for second at the line, Casar was still 26 seconds shy of taking the race lead, but moved into third in the general classification, behind Rodríguez and 's Ryder Hesjedal.
Stage 12 result RiderTeamTime 1 2 + 11" 3 + 11" 4 + 11" 5 + 11" 6 + 11" 7 + 11" 8 + 43" 9 + 48" 10 + 3' 34"General classification after stage 12 RiderTeamTime 1 2 + 17" 3 + 26" 4 + 32" 5 + 49" 6 + 52" 7 + 52" 8 + 57" 9 + 1' 02" 10 + 1' 03"
Stage 13 18 May 2012 — Savona to Cervere,
At , stage 13 was the shortest non-time trial stage of the entire Giro; again, the stage was undulating, with only one categorised climb at Montezemolo, into the itinerary. The stage was ideally set for the sprinters, potentially their last possible attempt to win a stage, with the final week of the Giro set to be all about the climbers and overall contenders for the race. The primary breakaway of the stage was formed early in the stage, when rider Martijn Keizer and 's Francesco Failli went clear in the opening stages of the day's running. By the point of the stage, the lead duo held their maximum lead of the day, when they were five-and-a-half minutes, after the peloton – led by and – elected to ease their pace.
The peloton steadily closed down the lead duo after that climb, and with around to go in the stage, Keizer and Failli were absorbed by the main pack. Once they were all together, the pace slowed again as many teams tried to get their protected riders into a safe enough position prior to the finish in Cervere. Having slowed the pace before, were on the front again, hoping to set up the sprint for their sprinter, Arnaud Démare; they were later joined on the front by the and teams, both of whom were looking to set up their respective Australian sprinters Mark Renshaw and Matthew Goss. Inside the final , three riders – Julien Bérard of , 's Julien Vermote and rider Fabio Felline tried to advance clear to alleviate an expected bunch sprint, but the sprint trains of and managed to close them down. Brett Lancaster launched Goss into his sprint, with Mark Cavendish () on his wheel. Cavendish tried to come down the left of Goss in the closing metres, but Goss closed the gap and Cavendish had to drop his pace, but recovered effortlessly and took Goss, and held on to win his third stage of the Giro. His 33rd Grand Tour stage win, Cavendish also extended his lead in the points classification, as Goss could only finish sixth behind 's Alexander Kristoff, Renshaw, rider Sacha Modolo and Elia Favilli of . Goss left the race following the stage, further extending Cavendish's lead.
Stage 13 result RiderTeamTime 1 2 s.t. 3 s.t. 4 s.t. 5 s.t. 6 s.t. 7 s.t. 8 s.t. 9 s.t. 10 s.t.General classification after stage 13 RiderTeamTime 1 2 + 17" 3 + 26" 4 + 32" 5 + 49" 6 + 52" 7 + 52" 8 + 57" 9 + 1' 02" 10 + 1' 03"
Stage 14 19 May 2012 — Cherasco to Cervinia,
The first categorised mountain stage of the race featured a near-flat opening to the stage, before almost worth of climbing in the remainder of the stage, with two first-category climbs, the Col de Joux – climbing up to an altitude of – and the finishing climb to Cervinia, reaching up to a height of via an average gradient of 5.5% over the . The climb to Cervinia was being used in the race for the first time since 1997, when eventual race winner Ivan Gotti took the race lead from Pavel Tonkov, and never relinquished the lead to the end of it. Prior to the stage, a minute's silence was held as a mark of respect to victims of a bombing at a school in Brindisi, earlier in the day.
With the stage parcours as such, there were no major movements off the race for the first hour of racing, before the weather conditions changed; rain would play in the rest of the day's proceedings. Eight riders went clear at around the mark, building up a lead of in excess of thirteen minutes over the main field. Three of the eight were dropped on the lower parts of the Col de Joux, while set the pace on the front of the field, reducing their advantage to around ten-and-a-half minutes. 's Jan Bárta had gone clear, while José Rujano () had linked up with rider Damiano Cunego to try and chase him. They could not do so, and instead it was left to Andrey Amador of the to foot the chase to Bárta. He caught him and eventually proceeded to drop him on the descent, and held a half-minute lead by the time he had reached the final climb to Cervinia. He extended the lead on the lower slopes of the climb itself, and soon held an advantage of over a minute over Rujano's team-mate Alessandro De Marchi, 's Matteo Montaguti, Bárta and 's Pierpaolo De Negri.
De Marchi and Bárta both later made solo attacks out of the group, and eventually caught up to Amador as the peloton grew ever-closer on the parcours. The peloton had been around five minutes behind with remaining, but the gap had been halved by the time they had reached the to go mark. De Marchi tried to break his two companions but could not do so; while in the peloton, there were several movements but it was not until Ryder Hesjedal got clear for that there was more animation in the peloton. Joaquim Rodríguez tried to follow his rival but was ultimately unsuccessful. At the front however, it was down to the three leaders for the sprint; Bárta tried to launch his sprint first, but fell short at the line as Amador achieved the first stage victory for a Costa Rican rider in any Grand Tour. De Marchi finished a couple of seconds behind in third, while Hesjedal gapped the Rodríguez group by 26 seconds to retake the maglia rosa. Hesjedal later stated that his attack on the climb was "unplanned", and that he was confident of taking the race victory in Milan.
Stage 14 result RiderTeamTime 1 2 s.t. 3 + 2" 4 + 20" 5 + 46" 6 + 46" 7 + 46" 8 + 46" 9 + 46" 10 + 46"General classification after stage 14 RiderTeamTime 1 2 + 9" 3 + 41" 4 + 1' 05" 5 + 1' 06" 6 + 1' 07" 7 + 1' 07" 8 + 1' 19" 9 + 1' 20" 10 + 1' 21"
Stage 15 20 May 2012 — Busto Arsizio to Lecco–Pian dei Resinelli,