Sky's rising star Egan Bernal won the stage from Ollon to Villars, while Primoz Roglic (LottoNL-Jumbo) retained the lead after finishing second ahead of Porte.
The Tasmanian, who was 10th last down the start ramp, tackled the 7.9 per cent average gradient in 25 minutes and 28.27 seconds. The Australian warmed the hot seat with his efforts until Bernal - seventh last down the ramp - finished 18 seconds faster. Roglic threatened for the stage win, ultimately finishing just four seconds slower than the Colombian.
Porte said he was motivated by the death of team owner Andy Rihs last week.
"I felt good until about two kilometres to go," Porte said. "And then I exploded but I was happy to finish it off like I did.
"It was a good ride and I think all of us are extra motivated by the passing of Andy Rihs last week so, it's nice to come to his backyard and have a good ride."
"Overall, I'm happy. It was a strong ride but normally I don't think I would have blown up as badly as I did in the final couple of kilometres. However, the team has been great behind me especially my coach, David Bailey, so we're motivated to try and finish this race off well."
Aussie Michael Matthews did not take to the start of stage 3 due to fatigue.