Manuel Lanzini scored on his debut for the visitors early on, but Constantin Budescu scored twice in five minutes before the break to put Astra 2-1 up on the night and 4-3 on aggregate.
Astra came close to wrapping the tie up several times in the second half, hitting the post and forcing Darren Randolph into two saves, and held on to end West Ham’s European campaign, which started on July 2.
West Ham, who made 11 changes from last week’s 2-2 draw at Upton Park, needed to score in Romania, and got the opener after just three minutes.
Lanzini, making his competitive debut for the Hammers, found the bottom corner from just inside the area as the ball broke to him after a melee in the six-yard box.
West Ham never settled, however, and the hosts nearly got level just moments later after Randolph misjudged Budescu’s deep free-kick, the right-hand post coming to the goalkeeper’s rescue.
But Budescu got his goal on 32 minutes, his low drive from 20 yards finding the bottom corner after Lanzini lost possession in midfield.
The striker then grabbed his sixth goal of the season four minutes later, slotting home coolly from 12 yards after a cut-back from the left, putting Astra ahead on the night and in the tie.
The hosts had more chances to see the game off in the second half; Fernando Boldrin getting ahead of his man only to blaze over from six yards, before Denis Alibec forced Randolph into a fine save.
Alibec then hit the post from an angle as Astra hit West Ham on the break several times late on, and despite some late pressure, West Ham could not find their equalising goal, ending their chances of reaching the Europa League first round stage for the first time since 2006.