Second-half goals from Pedro Obiang and André Ayew sealed West Ham’s first win of the season and alleviated the pressure on Slaven Bilic. The West Ham manager admitted the sacking of Frank de Boer by Crystal Palace earlier on Monday had been “in the back of my mind” before the match.

On the night, West Ham United did not look like a team of experienced, expensively recruited players. Their style was disjointed, their shape questionable. But in terms of fight and determination, Slaven Bilic’s side gave their all in the sort of performance you might associate with a far less glamorous side – a Huddersfield Town perhaps. In the end it was enough to take three points.

A deflected strike from Pedro Obiang was followed by André Ayew’s six-yard finish as West Ham cracked open a tightly contested encounter in the final 20 minutes. The Huddersfield manager, David Wagner, was disappointed in his team, who were organised in defence but rarely threatened going forward.

West Ham’s manager, meanwhile, was delighted. The game was scrappy and lacked quality but his team’s performance offered up half a dozen decent chances. On Bilic’s 49th birthday and after three consecutive demoralising defeats, this was a welcome gift.

“They gave everything,” Bilic said. “It was a top performance from us, not in the sense we played beautiful football but in other aspects. Determination in executing the game plan, in stopping them from doing anything.

“I’m 49 and I’ve been in serious football for 31 years,” Bilic added.

“I know how it goes, especially today, and I’m not going to lie, [De Boer] was in the back of my mind. But I’ve come to the zone where I don’t care about that. I care about the team. I saw my team really focus, not just today but yesterday, the day before.”

“It was a deserved defeat,” Wagner said. “Defensively we were OK, we were aware of the direct style. We got the flicks, we were good on the second balls but football is also an offensive game and offensively we weren’t good enough. We made so many unforced errors, bad decisions. It makes totally no sense to play without bravery and confidence especially after what the boys have done in the past. We haven’t shown what we are capable of.”

Wagner’s criticisms could have been equally applicable to the hosts. West Ham were making their first home appearance of the season and had adopted a new formation. Bilic, acting to plug the leaks that had led to his team accruing a goal difference of minus eight, had shifted to a back three, with James Collins returning to the team. Up front there was room for both Javier Hernández and Andy Carroll, the England striker making his first start in five months.

With Michail Antonio also in attack it was an unfamiliar and often uncertain formation, one held together by individual gumption. That said, it created chances and West Ham could have been ahead after only two minutes. A floated cross from the right found Carroll at the back post. Instead of heading, however, he opted to drop off his man and took the ball on his chest. Carroll then flashed the ball across goal but a sliding Cheikhou Kouyaté could not turn it over the line even from inches away.

Pedro Obiang’s shot deflects off Huddersfield defender Mathias Jorgensen and loops into the net. Photograph: Ben Stansall/AFP/Getty Images

Ten minutes later and another clear opportunity came the home side’s way. This time it was all of Antonio’s making as he powered past Chris Löwe and again managed to cut the ball back across the box. This time the cross skewed to Hernández but the Mexican poacher crashed his shot off the bar.

With five minutes of the half remaining, they crafted another opportunity, Carroll forcing Mathias Jorgensen into a weak clearing header only for Kouyaté, standing on the penalty spot, to make a complete hash of his shot.

For all that Wagner was down on his team for a lack of assertiveness, Huddersfield began to come into the game in the second half. They started to throw more numbers forward. Philip Billing forced Joe Hart into his first save in the 54th minute. On the hour they eked out their first corner.

At the other end West Ham were starting to look ragged. Hernández in particular was struggling in an unusual position at inside-forward. He was trying his best and twice tried to slide in the hard running Antonio but neither opening resulted in a shot. With 25 minutes remaining he was removed in favour of Ayew and it turned out to be the spark that changed the game.

In the 72nd minute the Ghana forward found Obiang just outside the penalty box. The midfielder unleashed a fierce, left-foot shot which hit Jorgensen, who had turned his back on it, and was deflected well over his goalkeeper Jonas Lössl and into the net. Five minutes later Ayew was on hand to force home another Aaron Cresswell corner. The relief in the stadium was palpable. Bilic jumped up and down like a birthday boy about to unwrap his presents.

After victory was sealed, Bilic sought to clarify remarks he had made about his chairman, David Sullivan, who had claimed the Croat had turned down the chance to sign Renato Sanches and Grzegorz Krychowiak.

“I’ve said some things. I said them and I wasn’t drunk,” Bilic said.

“I said nothing bad about the chairman, on the contrary I said we’d done good business. I defended him and just wanted to clear the situation with Sanches and Krychowiak. I didn’t want those players.”

Bilic added that, after a troubled year, the London Stadium was starting to feel like home. “We couldn’t wait to play here again,” he said. “This is the situation now. It will never be Upton Park but it doesn’t mean it can’t be our home. I really have a feeling and I see the players that we like it more and more here. That can only come with good results and good individual performances.” He achieved the former in this match, at least.