The Slovakian, who also won the first two stages of the eight-day race, made it a perfect three from three when he surged clear of the pack approaching the finish line to win the 186 kilometre trek from San Jose to Livermore in four hours, 50 minutes and 49 seconds.
"I don't know what to say, it was a surprise to me," said Sagan.
"Today was hotter than yesterday and that's not usually good for me, but today the temperature was right."
For the third day in a row, Australia's Heinrich Haussler crossed the line second. Belgium's Tom Boonen, the 2005 world road race champion, came third to get on to the podium.
A breakaway group of four riders opened up an eight minute lead over the main pack but were caught 25km from the end.
Sagan retained the yellow jersey and stretched his overall lead to 12 seconds from Haussler. American Jeff Louder moved to third, trailing Sagan by 22 seconds with five stages to go in the Golden State.
Last year's race winner, American Chris Horner, finished safely in the middle of the pack for the third straight day. He was in equal 15th place overall among a large group of riders 30 seconds behind Sagan.
Despite winning the first three stages, the 22-year-old Sagan said he was not expecting to win the race. Wednesday's fourth stage, a 209 kilometre trip from Sonora to Clovis, is the longest of the tour and is a followed, a day later by a time-trial.
"The race has hard long climbs and for me, I am not good in the time trial," he said.
"I will try my best to get keep the yellow jersey until, but then we will see."