Harlequins secured a last-16 place in the Heineken Champions Cup with an entertaining bonus-point win over South African side Sharks at The Stoop.
The hosts edged a high-scoring first half 24-22, with both sides scoring three tries before the break.
Danny Care, on his 350th outing for Quins, Alex Dombrandt and new England call-up Cadan Murley crossed for the Premiership club before half-time.
Stephan Lewies and Nick David also went over to confirm Quins' progression.
Sharks had already secured a place in the knockout stage after winning their first three matches in the pool phase, including against Harlequins in December, and must wait to find out if they will have a home tie in the last 16 when the tournament resumes at the end of March.
Aphelele Fassi's score two minutes before full-time, which secured a bonus point for scoring four tries, could prove critical in the final standings.
Tries flow in entertaining Quins victory
Despite their qualification already being confirmed, Sharks selected a strong line-up and made the perfect start when Thaakir Abrahams collected a lofted kick and passed inside for centre Lukhanyo Am to cruise over unchallenged after just 94 seconds.
Harlequins' response was swift, with three tries before the 20-minute mark.
Care nipped over from a ruck in typical fashion, before David set up captain Dombrandt and winger Murley rounded off a quick passing move in the right corner to make it 21-8.
But the gap was down to two points by the interval, with Sharks scrum-half Jaden Hendrikse the beneficiary of a powerful Marnus Potgieter run and Eben Etzebeth adding an opportunist third for the visitors.
As Care shaped to box kick, Joe Marler's bind to the back of the ruck loosened, South Africa lock Etzebeth scooped up the ball and ran clear to score.
Tries continued to flow after the interval as Lewies, fresh from signing a new deal with the 2020-21 Premiership champions, grabbed a line-out to score against his former club.
Sharks attacked in search of a response but that opened up gaps for Quins to exploit and full-back David did so perfectly, collecting the ball on his own 22 and kicking ahead into space before galloping clear for Quins' fifth and final try.
The home side's defence held firm after that, preventing any Sharks points until Fassi's score in the final seconds.
Smith 'verging on being world class'
Harlequins' England fly-half Marcus Smith, making his second appearance since recovering from an ankle injury, continued his return with the Six Nations on the horizon and kicked six of his seven attempts from the tee for a total of 14 points.
"For Marcus to do 80 minutes two games in a row and be in really good physical condition after that injury is phenomenal," said head coach Tabai Matson.
"It shows his work ethic, his preparation, because you would never have thought he had that much time out of the game.
"He's great to watch. He's clearly a quality player and is verging on being world class.
"When the conditions are right and he's got a forward pack that does what it does and we win the physicality battle, he's always going to look good on the front foot."
Line-ups
Harlequins: David, Murley, Marchant, Esterhuizen, Bassett, Smith, Care; Marler, Walker, Louw, Lewies, Herbst, Lamb, Evans, Dombrandt (c).
Replacements: Head, Baxter, Kerrod, Lawday, Wallace, Steele, Allan, Beard.
Sharks: Fassi, Potgieter, Am, Tapuai, Abrahams, Bosch, Hendrikse; Nche, Van Vuuren, Du Toit, Etzebeth, Grobler, Kolisi (c), Tshituka, Buthelezi.
Replacements: Jooste, Mchunu, Sadie, Andrews, Notshe, Williams, Cronje, Venter.
Referee: Nika Amashukeli (Georgia)