The Portuguese boss described the match at Goodison Park as a "must-win" game following four straight league defeats and a goal from Brazil forward Bernard in the 17th minute set his side on their way.
Everton dominated the match and had multiple chances to extend their lead but were forced to wait until injury time to score their second, through late substitute Gylfi Sigurdsson.
Victory in Saturday's early kick-off lifted Everton to the relative safety of 12th in the table, one place above struggling Manchester United, ahead of the later fixtures.
"It was a fantastic performance," Sigurdsson told BT Sport. "We had a lot of chances, especially in the second half. You never know when it's 1-0 -- you always want to get more.
"They are dangerous going forward and their goalkeeper made some spectacular saves. I was pleased to come on and give us a bit of comfort. There was a real purpose to our game today."
Bernard made the breakthrough after latching onto a fine ball from Theo Walcott. The Brazilian declined to shoot first time as Arthur Masuaku closed him down but he cleverly cut back and wrong-footed the defender before sliding the ball under Roberto.
Richarlison went close to a second from an Alex Iwobi pass but his low shot came back off a post and Iwobi then shot at Roberto from distance.
A disappointing West Ham side made it to the break trailing by just a single goal but Everton were quickly on top again in the second half.
Richarlison had the ball in the net just after the re-start following a neat build-up but his well-taken effort was ruled out for off-side.
Pablo Fornals had a golden chance to equalise minutes later but he could only steer it wide of the left post, falling to his knees in disappointment.
Yerry Mina twice headed too close to Roberto from corners and the Toffees went close again as Walcott rattled the crossbar with a ferocious half-volley before Iwobi wasted another chance, shooting straight at Roberto when clean through.
Despite being outplayed, West Ham were still in the game and earned a couple of late chances against an increasingly edgy Everton.
Everton goalkeeper Jordan Pickford did well to keep out a deflected close-range strike from Angelo Ogbonna.
But the home side finally made the game safe when Sigurdsson curled the ball past the diving Roberto from the edge of the box.