Peter Sagan showed a remarkable display of climbing to claim victory on stage three at the Tour de Suisse.