If you were surprised to see Tinkoff-Saxo’s Peter Sagan standing atop the podium at the end of the eight-day Amgen Tour of California Sunday, you weren’t the only one. Sagan went into this year’s race with 11 ATOC stage wins and five green jerseys on his resume, so he was expected to win a few stages. But the overall title? Few saw that coming. In the end, several factors helped the 25-year-old sprinter take the most important stage race victory of his career. Here’s a look:

Time bonuses. Stage races offer bonus seconds to make flatter stages more of a factor in the General Classification, especially during races in which several stages might end in field sprints. But they don’t determine the race’s final outcome—well, usually. At this year’s ATOC, Stages 1, 2, 4, 5, and 8 offered time bonuses to the top three riders at the day’s intermediate sprint and the first three riders to cross the finish line. Sagan finished each of those stages among the top three (including one victory) earning a total of 30 bonus seconds (plus 2 more for finishing second in Stage 8’s intermediate sprint). The math is simple: Were it not for those 32 seconds, Sagan would not have won the Tour.

The weather. Stage 6 was supposed to be a 15-mile individual time trial at altitude in Big Bear Lake—until a wintry forecast for several inches of snow prompted race organizers to move the stage to a lower altitude (Santa Clarita’s Six Flags Magic Mountain theme park) and shorten it to only 6.6 miles. All of this played into Sagan’s hands. While he’s known more for his sprinting (three consecutive green jerseys at the Tour de France will do that), Sagan’s no slouch against the clock. In 2012 he beat four-time World Time Trial Champion Fabian Cancellara to win the opening time trial at the Tour of Switzerland—on a course just a tad shorter than Stage 6’s. Had Sagan been forced to race at altitude and over a longer distance, the outcome likely would have been much different.

Guts. In 2012, the last time a stage of the ATOC finished on Mt. Baldy, Sagan lost more than 25 minutes to stage winner Robert Gesink (who went on the win the race). So it’s safe to say that few took the Slovak’s chances seriously when the race returned to the mountain on Stage 7 this year. But perhaps inspired by the fact that his team’s owner, Oleg Tinkov, has been critical of Sagan’s mediocre start to the season, Sagan proved everyone wrong. His incredible ride was enough for sixth place on the day, only 47 seconds behind stage winner Julian Alaphilippe.

The competition. Sagan’s victory was also helped by the fact that none of the men expected to battle for the GC (LottoNL’s Robert Gesink, Sky’s Sergio Henao, and Cannondale-Garmin’s Joe Dombrowski) were truly up to the challenge. On Mt. Baldy, Gesink was dropped quickly, Henao couldn’t respond to Alaphilippe’s attacks, and Dombrowksi seemed satisfied with protecting his top-five placing. This left the door open for Sagan to defend his place near the top of the General Classification on a stage when few expected him to do so. Had more riders attacked—and sooner—Sagan would certainly have lost more time. But they didn’t, so he didn’t.

A bike throw. It’s not often that cycling becomes a game of inches, but this year’s ATOC came down to a perfectly executed bike throw as Sagan lunged across the line in Pasadena to take third place (and four bonus seconds) by the width of his tire. An interesting side note: This isn’t the only time Sagan has won a stage race by earning bonuses on the race’s final day. In the 2011, he won enough bonuses on the final stage to win the Tour of Poland. The loser that day? Garmin’s Irish climber, Daniel Martin.

So does this mean we can expect to see Peter Sagan chasing more GC titles? Could the still-young Slovak be a future Tour de France contender? Don’t bet on it. While supremely talented, Sagan knows he’s better-suited to winning one-day Classics and sprints. But as he proved this week, when the constellations align he knows how to take advantage of a situation that shifts in his favor.