West Ham came from behind to beat Leicester and take their battle with Southampton for automatic promotion to the Premier League to the final day.

The Foxes led when Ben Marshall's cross was headed home by Jermaine Beckford but five minutes later Winston Reid prodded home a leveller from Matty Taylor's centre.

And Jack Collison scored the Hammers' winner, firing home from 25 yards.

West Ham are two points behind the Saints going into the final day.

The Hammers need to beat Hull City on the final day and hope that Southampton lose to relegated Coventry. If the Saints draw, West Ham would need to win by three or four - depending on how many goals the Saints score - to clinch promotion.

West Ham started the brighter and Ricardo Vaz Te almost got onto the end of Mark Noble's through ball but it ran just too far and into Kasper Schmeichel's hands in the Leicester goal.

The Foxes goalkeeper then saved well down low from Collison's shot after Sol Bamba was caught dawdling by Carlton Cole.

Noble's free-kick was headed wide by Cole, who was then only denied by a last-ditch Wes Morgan challenge after chasing onto Noble's 60-yard ball.

Final day permutations

Southampton will be promoted if they beat Coventry.

If they lose, West Ham need a win against Hull to secure promotion.

If they draw, West Ham will be promoted if they beat Hull by a four-goal margin. A two-goal margin or less will see Saints promoted, while a three-goal margin will see promotion go down to goals scored, then head-to-head record.

Leicester showed they would give the Hammers a game, despite having little to play for, and Beckford headed wide from Lloyd Dyer's cross.

At the other end, Nolan flashed a half-volley wide with the outside of his boot and moments later his side fell behind. Marshall won the ball from Taylor on the right-hand side and floated it into the centre where Beckford made amends for his previous miss.

Leicester's lead was shortlived though. Noble rolled the ball to Taylor, whose wonderful low cross was converted from close range by Reid.

And with the momentum all West Ham's, Vaz Te had a powerful effort deflected wide by Morgan, Tomkins headed past the post and Vaz Te flashed a free-kick wide.

Media playback is not supported on this device

We weren't clinical enough - Pearson

After the break, West Ham continued to chase the goal they needed to keep their automatic promotion dreams alive.

Soon after the restart, Noble hit a brilliant shot from the edge of box that went just wide and then fired well over after Gary O'Neil found him unmarked from a similar distance.

And their persistence paid off when O'Neil's shot was cleared by the Leicester defence but only as far as Collison, who smashed the ball home. Schmeichel got a hand to the effort but could not keep it out.

Moments later Collison could have killed the game off but his shot was deflected over by Bamba.

The Hammers continued to push for a third goal to seal the game and boost their goal difference and Tomkins headed wide, while Vaz Te and Collison failed to capitalise on a great chance to shoot in the box.

Leicester's Marshall had an effort from 25 yards out that was easily handed by Green. And minutes later, perhaps sensing that the game was not yet won, Sam Allardyce brought on defender Danny Collins for striker Cole and the Hammers saw the game out.

After Nolan missed a chance to add a late third, they almost paid the ultimate price with Green having to save Morgan's last-gasp header.

West Ham boss Sam Allardyce: "I think that under the pressure and under the circumstances it was a fantastic victory, especially as we had to come from behind - and Jack Collison's winning goal was a cracker.

"It is a good night and we have stayed in the race, which is what we wanted, and now we have got to do our job and hope that Southampton get the jitters and Coventry can do us a favour.

"The pressure on them will be enormous to finish off the fantastic season they have had and hopefully that will put them off their game.

"The odds are Southampton will win the game - that is what everyone expects - but football is a strange game and any team on a day can cause an upset, as we have seen all season."

Leicester boss Nigel Pearson: "It is a disappointing way to round off the home campaign. Their clinical finishing was the difference but in the end they had too much for us and I have no complaints.

"Richie Wellens will have a scan on Tuesday. It doesn't look promising at the moment. And likewise with Andy King, who has a foot injury that is maybe similar to his original injury but hopefully isn't as bad.

"They are things we could do without at this stage of the season, certainly with our numbers being short in midfield."