Manuel Pellegrini got the performance he demanded from Felipe Anderson after West Ham’s record buy sank Burnley.

The Brazilian playmaker was in grave danger of being branded a £42million flop following some anonymous displays since his summer switch from Lazio.

Pellegrini admitted this week that Anderson’s showings needed to improve, especially after the 25-year-old was hauled off at half-time in the Carabao Cup defeat by Tottenham.

But it seems Anderson was listening as two well-taken goals secured a deserved 4-2 win for the Hammers.

“Yes, I’m delighted for him because we know what he can give us,” said Pellegrini.

“I said before the game that maybe some players need more time to adapt to the league, but his commitment has always been 100 per cent. He was the first person not happy with his performances.

“I talked a lot with him, and there was never a chance of him not playing today. He knew from the beginning that despite playing bad against Tottenham, he was going to play today. It was a massive performance.”

A “crazy game”, as Burnley boss Sean Dyche described it, began with James Tarkowski gifting the opening goal to Marko Arnautovic.

The defender had clattered Arnautovic moments earlier so it was a sweet moment for the Austrian who pointedly celebrated in the embarrassed Tarkowski’s face.

West Ham should have been out of sight by half-time but Joe Hart denied Arnautovic, Ben Mee somehow headed Anderson’s curler off the line and referee Roger East missed a blatant penalty after Steven Defour tripped Grady Diangana.

“Their lad gets brought down and it’s a penalty, but because he falls normally nothing’s given,” was Dyche’s magnanimous take on the incident.

“I guarantee if he rolls around, flinging his arms around – and credit to him for just falling normally – they get a penalty.”

It was comfortably West Ham’s most commanding 44 minutes of the season, and yet somehow they still went in level at half-time after Johann Berg Gudmundsson equalised.

Anderson’s first goal, through the legs of Hart, put them back in front but they were pegged back again by Chris Wood’s header.

In recent seasons West Ham would have drawn, or even lost this match, but Pellegrini’s insistence on them playing on the front foot paid off with Anderson’s second and Javier Hernandez’s stoppage-time strike.

“I try to have a team that don’t play with the score on the board, we have a style of play,” added Pellegrini.

“You don’t need to continue to play towards your own box if you are level or losing, you must continue to play in the same way, and I think today was a test for the players.

“We were twice ahead, they drew twice, then we scored the third and then wanted to score a fourth, not just to defend our advantage.”

Burnley have now lost their last three matches, shipping 13 goals in the process.

But Dyche insisted: “There’s work to be done but the mentality on show today was very positive. The margins are fine.

“It’s the first time we’ve had a sticky spell in quite a long time, but it’s fuel for us.”