The stage was originally a 160km route finishing with four 28km laps but was changed to just three laps due to the sweltering Argentinian heat.
Julian Alaphilippe won the day ahead of Simone Consonni and Sagan following four ascents of the 8.3 per cent Alto Punta Negra and the climb to the finish, with the Slovak National Champion proving he can climb with the very best.
Sagan said in a press release issued by his team: "Again, the whole team did an excellent job, they set a strong pace at the front and controlled the race.
"In the final kilometres when Alaphilippe attacked there wasn't a lot of cooperation in the chasing group and we weren't able to close the gap.
"My form is progressing the way it should this time of the year, so all is good and we'll keep fighting every day."
A four-man break provided much of the day's entertainment as they built up an advantage of 3:34 before the heat began to suffocate them one by one.
The Extreme Weather Protocol only applies to WorldTour and HC races and as the Vuelta a San Juan is a 2.1 category race, a more informal approach was taken, with race organisers considering the weather warning issued by government agencies in Argentina.
As the break hit the final 28km, they were whittled down to just two with the peloton less than a minute behind and before long it became a solo effort as their chances of staying clear slipped away.
A heavily-reduced bunch made the catch with 10km to go with Sagan's Bora-Hansgrohe teammates pushing the pace at the front.
As the riders reached the final climb with 2.5km to go, the attacks began to come from the climbers while Bora's domestiques tried to keep the race together.
Alaphilippe, who now trails Fernando Gaviria by three seconds in the general classification, was the only rider who managed to sustain his attack and stay clear to the line, as the sprint for the minor places piled up behind him.
Sagan meanwhile showed his strength up the steep incline to claim third and built on his ninth-place finish in the opening stage.
The former three-time world champion is just nine seconds off overall leader Gaviria heading into stage 3 at the Vuelta a San Juan.
Thank you for signing up to Cycling News. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.