Konstantinos Fortounis made the breakthrough in the 33rd minute of the contest before Rodinei's effort was deflected into the back of the West Ham net by Hammers defender Angelo Ogbonna shortly before the break.
Lucas Paqueta's excellent volley gave the visitors a lifeline late on, but the London club could not find a second.
David Moyes's side remain top of Group A on six points, with Olympiacos now in second on four points, and the two teams will lock horns at London Stadium for the reverse fixture on November 9.
Pablo Fornals had West Ham's first shot of the night in the sixth minute after breaking into a dangerous area, but his effort was comfortably gathered by the home side's goalkeeper Alexandros Paschalakis.
West Ham's stopper Alphonse Areola then had to be alert down the other end to keep out a powerful drive from Sotiris Alexandropoulos, with the home side looking dangerous on the transition.
Rodinei's speculative effort in the 18th minute almost caught out Areola, with the ball only just missing the target, and it was an open match, with both teams looking dangerous in the final third of the field.
Olympiacos made the breakthrough in the 33rd minute of the contest courtesy of an excellent strike from Fortounis, who picked out the bottom corner with almost a toe poke from the edge of the box.
The home side then doubled their advantage in the closing stages of the first half, with Ogbonna turning a cross from Rodinei into the back of his own net from close range.
Danny Ings came close to halving the deficit moments later when he was found by Fornals inside the Olympiacos box, but he was denied by Paschalakis, as the hosts entered the break two goals ahead.
Ings clipped an early chance over the Olympiacos crossbar after the restart, with West Ham looking to be more purposeful in the final third of the field.
Ings had another half-chance shortly after, heading over from inside the box, and he was then substituted alongside Fornals and Said Benrahma, with Michail Antonio, Paqueta and Jarrod Bowen entering the field.
However, Olympiacos continued to look the more likely, with Alexandropoulos having a shot deflected just too high in the 71st minute, with West Ham finding it difficult to stem the flow of pressure.
Jackson Porozo headed just wide of the away side's goal in the 80th minute after Areola had made a smart save to deny the lively Alexandropoulos, who was a problem for West Ham throughout the match.
The Hammers managed to halve the deficit in the 87th minute through Paqueta, who found the back of the net with a brilliant volley from outside the box, but Olympiacos held firm in the eight minutes of added time to claim a vital win on home soil.