Gianluca Scamacca scored his first West Ham goal as the Hammers established a commanding 3-1 lead over Viborg in the first leg of their Europa Conference League play-off clash.
Jarrod Bowen and Michail Antonio were also on target for the hosts at the London Stadium, with Jakob Bonde's header providing a consolation for the visitors ahead of next week's return leg in Denmark.
The Hammers' fortunes were overseen by first-team coach Billy McKinlay, with manager David Moyes serving a touchline ban following his red card in last season's Europa League semi-final defeat by Eintracht Frankfurt.
Vladimir Coufal wore the captain's armband in the absence of Declan Rice and Aaron Cresswell – both also serving continental suspensions – but the hosts took the lead in the 24th minute; Scamacca rising to head home Maxwel Cornet's inviting cross.
They doubled their lead after 64 minutes as Bowen collected a loose ball, before brilliantly drilling low past Lucas Lund from 30 yards. The visitors halved the deficit five minutes later when Bonde arrived at the far post to nod home Christian Sorensen's centre.
But substitutes Antonio and Said Benrahma combined to restore the hosts' two-goal buffer in the 78th minute. Benrahma embarked on a jinking run from the left flank, before squaring for Antonio to tuck into the empty net.