Slovak rider Peter Sagan edged the pack in a sprint to win the 21st and final stage, a 95.6-kilometer (59.4-mile) ride from the Circuito del Jarama race track to the city center in 2 hours, 20 minutes, 59 seconds. It was Sagan's third stage win of the event.

Cobo rode across the line together with his Geox teammates to celebrate the win.

Cobo finished the 66th edition of the classic race in 84 hours, 59 minutes, 31 seconds. Froome's compatriot and Sky teammate Bradley Wiggins was third, 1:39 behind.

Dutch rider Bauke Mollema came in fourth overall, more than 2 minutes back, while defending champion Vicenzo Nibali of Italy settled for seventh, 4:31 behind.

The red leader's jersey passed between eight riders until Cobo took it from Wiggins in a grueling 15th stage that finished at the fog-shrouded mountain pass of Alto De L'Angliru in the northern region of Asturias.

The Kenyan-born Froome's biggest challenge to Cobo came two days later when the two riders had a back-and-forth uphill battle to the Pena Cabarga peak. Froome won the stage, but Cobo held on to his slim overall lead.

The 30-year-old Cobo then withstood Froome's repeated attacks during the final week to claim his first major race victory.

Neither Cobo nor Froome entered the three-week race as favorites. Cobo was supposed to support his Geox teammates Carlos Sastre and two-time winner Denis Menchov, while the 26-year-old Froome came with the mission of helping Wiggins.

Cobo's only previous win was the Basque Country Vuelta in 2007.

This year's edition featured two stages in the Basque country after a 33-year absence due to political unrest related to separatist group ETA, whose 40-year-long bloody campaign for independence has left more than 800 people dead. ETA's announcement of a cease-fire last January opened the way to the race's return to the northern Spanish region.