Striker Diafra Sakho scored twice and James Tomkins added a third to put the Hammers in control of the first qualifying-round tie.
They were watched by a capacity crowd of about 35,000, as well as new manager Slaven Bilic, who was in the stands but not in charge.
The second leg takes place on 9 July.
The Hammers qualified for the Europa League via the Fair Play League and their reward was a first match of the 2015-16 season 40 days after the final Premier League match of the 2014-15 campaign.
But despite the lack of a significant summer break, there was an upbeat atmosphere at Upton Park, with Bilic receiving a rousing reception when he was presented to the crowd before kick-off.
With the 46-year-old Croat assuming a watching brief, academy manager Terry Westley took charge, and he had to endure a frustrating wait before seeing his side make the breakthrough.
Despite their dominance, it took until the 40th minute for the Hammers to take the lead, Senegal striker Sakho heading in from six yards after Mauro Zarate's cross from the right.
They doubled their advantage just before half-time when Sakho converted Morgan Amalfitano's cutback from close range.
Sakho and Zarate were two of the more senior players in a line-up which mixed experience and youth. Midfielder Reece Oxford was given his debut and, in the process, the 16-year-old became the youngest player to represent the club.
But it was experience which made the difference, Tomkins adding the third goal from a Matt Jarvis cross just before the hour mark with a close-range header to put West Ham in control of the tie.
West Ham began their long journey towards the Europa League group stage with a comfortable first-leg victory over Andorran side Lusitanos.