Porte had little to do but follow the wheels as him BMC Racing team did a good job of controlling the race on the final climb, with Mikel Landa (Movistar) launching a powerful attack that gained him 15 seconds at one point and saw the yellow jersey of Stefan Küng (BMC Racing) quickly distanced.
Most of Landa's lead was cut down by a late attack by Matthias Frank (Ag2r La Mondiale), before Ulissi launched his bid for glory with 200m to go.
Sprinting into a headwind Ulissi looked like he might be challenged by Enric Mas (Quick-Step Floors), but the Italian was able to hold on to the line as Porte crossed the line in eighth placed to move into the race lead.
How it happened
Stage five of the Tour de Suisse saw the riders face a rude start to the day, with the first-category climb of the Col du Pillon tackled straight from the gun.
That start meant that the opening kilometres saw plenty of attacking, but no one was able to get clear on the climb or the subsequent descent, and it was only after more than 60km of the stage had been covered that a breakaway was finally able to form.
Jasper Stuyven (Trek-Segafredo), Daniel Oss (Bora-Hansgrohe), and Silvan Dillier (Ag2r La Mondiale) were the first three to slip away, before they were joined by Larry Warbasse (Aqua Blue Sport), Willie Smit (Katusha-Alpecin), and Paul Ourselin (Direct Energie) to form a six-strong lead group.
Those riders steadily opened a lead of three minutes back to the main bunch which they held onto the second climb of the day, a hors-catègorie ascent to Montana, which they started with 50km remaining in the day.
The climb saw splits at the front of the race, with Warbasse attacking to drop his breakaway companions, while in the main bunch race leader Küng suffered a puncture but was able to get back on without too much trouble.
BMC Racing continued to set the pace up the climb, but saw attacks go clear with Victor de la Parte (Movistar), Omar Fraile (Astana), and Romain Sicard and Lilian Calmejane (Direct Energie) going clear.
Those three riders joined up with the remains of the break, less Warbasse, who pushed on along over the top of the climb and onto the descent.
The final climb Leukerbad started almost immediately after the descent, with Warbasse holding a lead of just over a minute over the peloton, while Calmejane attacked out of the group behind.
The Frenchman made short work of the gap to Warbasse, and duly attacked the American champion, but BMC Racing were still chasing hard behind and had the gap down to a very manageable 30 seconds with 13km to go.
The work of Greg Van Avermaet saw that lead come down further, with Calmejane caught with 6.9km to go, but as soon as the Frenchman was caught the counter-attacks started.
Hugh Carthy (EF Education-First Drapac) and François Bidard (Ag2r La Mondiale) were the first to go, but the biggest attack came from Mikel Landa (Movistar) who quickly bridged across to Carthy and Bidard as race leader Küng was dropped.
Carthy was doing most of the work on the front, but as Landa started to lend a hand Bidard was dropped, while Tejay van Garderen took over pace-setting on behalf of Richie Porte on the front of the bunch.
With a lead of only 10 seconds over the bunch, Landa pushed on to drop Carthy, but was still being pegged back by Jesper Hansen (Astana), working on behalf of team leader Jakob Fuglsang.
The road flattened out with 2.5km to go, and Landa found a little extra in his legs to hold his slender gap while Bahrain-Merida chased, before an attack by Matthias Frank (Ag2r La Mondiale) came close to reeling him in.
That flurry of action brought Landa back to within touching distance, and the Spaniard was duly caught and passed as Diego Ulissi (UAE Team Emirates) launched his sprint.
The Italian puncheur seemed to have gone early and had Enric Mas locked firmly in his wheel, but was able to hold on in the headwind that was blowing up the finish straight to take the victory.
Meanwhile Richie Porte (BMC Racing) finished in eighth place on the day, meaning that he moved into race lead with four stages to go.
Tour de Suisse, stage five: Gstaad to Leukerbad, 155km
1 Diego Ulissi (Ita) UAE Team Emirates, in 3-37-31
2 Enric Mas (Esp) Quick-Step Floors
3 Tom-Jelte Slagter (Ned) Dimension Data
4 Wilco Kelderman (Ned) Team Sunweb
5 Bauke Mollema (Ned) Trek-Segafredo
6 Simon Spilak (Slo) Katusha-Alpecin
7 Nairo Quintana (Col) Movistar
8 Richie Porte (Aus) BMC Racing
9 Sam Oomen (Ned) Team Sunweb
10 Bjorg Lambrecht (Bel) Lotto Soudal, all at same time
General classification after stage five
1. Richie Porte (Aus) BMC Racing, in 17-03-53
2. Wilco Kelderman (Ned) Team Sunweb, at 20 secs
3. Sam Oomen (Ned) Team Sunweb, at same time
4. Enric Mas (Esp) Quick-Step Floors, at 21 secs
5. Jack Haig (Aus) Mitchelton-Scott, at 29 secs
6. Nairo Quintana (Col) Movistar, at 33 secs
7. Ion Izagirre (Esp) Bahrain-Merida, at 36 secs
8. Diego Ulissi (Ita) UAE Team Emirates, at 40 secs
9. Simon Spilak (Slo) Katusha-Alpecin, at 46 secs
10. Mikel Landa (Esp) Movistar, at 47 secs
Thank you for reading 5 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1
Henry Robertshaw began his time at Cycling Weekly working with the tech team, writing reviews, buying guides and appearing in videos advising on how to dress for the seasons. He later moved over to the news team, where his work focused on the professional peloton as well as legislation and provision for cycling. He's since moved his career in a new direction, with a role at the Department for Environment, Food and Rural Affairs.
Tech of the Month December: Tacx Neo Bike Plus vs Wahoo Kickr Bike V2 and how wide will road wheels go?
We discuss the direction of road wheel design and which is best out of the two most recently updated smart trainers
By Luke Friend • Published
Drama on final night of Track Champions League as Richardson just pips Lavreysen
There were three British wins in London, but Katie Archibald was unable to overturn Jennifer Valente's lead in the endurance competition
By Chris Marshall-Bell • Published
Geraint Thomas takes overall victory at Tour de Suisse as Remco Evenepoel wins stage eight time-trial
The Welshman has found his form ahead of the Tour de France
By Pete Trifunovic • Published
Thibaut Pinot wins Tour de Suisse stage seven as Sergio Higuita takes the overall lead
The Frenchman secured his second win of the year
By Pete Trifunovic • Published