Jesse Lingard's first half brace put David Moyes' side in control at the London Stadium before an early second-half goal courtesy of Jarrod Bowen reaffirmed their grip of the game.
Kelechi Iheanacho's double made it a nervy ending in East London however the hosts were able to hold on for the win.
The win means West Ham are now just a point behind Leicester in fourth place with their dreams of securing a place in the UEFA Champions looking more of a reality than evert.
Story of the match
The opening stages saw a cagey affair between the two sides with neither team failing to create any significant opportunity.
It would take time but the game finally came to life just shy of the 30-minute mark where Lingard broke the deadlock.
Tomas Soucek found time and space on the right hand side to look up and pick out the Manchester United loanee in space.
On the half volley, Lingard was able to whip the ball round the Leicester defence and leave Kasper Schmeichel rooted to the spot to put the Hammers in front.
Lingard then doubled West Ham's lead shortly before half-time to put the hosts well in the ascendancy.
Jarrod Bowen reacted quickest to a long ball over the top and with an onrushing Schmeichel coming his way, opted to roll the ball along to the in-form England international who slotted home into an empty net.
West Ham started where they left off in the second-half as Bowen soon made it three.
Poor play from Kelechi Iheanacho saw the Nigerian give the ball away and allow West Ham to come forward, splitting the Leicester backline wide with a through ball from Soucek for the former Hull City man able to rifle home from close range.
West Ham then thought that had a fourth as Issa Diop headed home from close range however his goal was chalked off for offside following a VAR check.
Leicester's first chance of the half didn't come until the 60th minute after Marc Albrighton had an opportunity to reduce the deficit.
A through ball from Iheanacho into the path of the substitute initially looked an easy task for Lukasz Fabianski however after failing to hold onto the ball, Albrighton looked to find the target but his shot was blocked away for a corner.
The Foxes found a consolation 20 minutes from time through Iheanacho. His well-struck effort from outside the box flew past Fabianski after the West Ham defence gave the striker far too much space to shoot.
There was more drama to come at the end as Iheanacho fired home from close range in injury time to give Leicester feint hopes of finding an equaliser however despite their attempts, were unable to complete the comeback.
Costly points dropped for Foxes
With the race for the top four getting closer and closer with each week, any dropped points are costly ones and it will feel that way for Brendan Rodgers and Leicester today.
The first-half performance all but ensured that Leicester wouldn't be on the winning end. With poor decision making and a real lack of urgency, West Ham capitalised and made the Foxes pay.
Whilst the first of Lingard's two goals was a great finish, the second could have been easily avoided, with Leicester's high-line being taken advantage of by the Hammers.
Lingard for the Euros?
It's been on the mind of many for the last few weeks but it seems inevitable that Jesse Lingard will be named in the England squad for this summer's European Championships.
With Gareth Southgate watching on, Lingard delivered yet another classy display and with his brace now takes his goal contribution tally to 10 in seven games.
It was only six months ago that the 28-year-old couldn't get a look in at his parent club, but with Lingard now in arguably the best form of his career, his place in the 23-man squad for the summer would certainly be deserved.
Nervy Ending for Hammers
For the best part of 60 minutes, it was as easy as you like for West Ham who looked set to record a comfortable win.
Fast forward to the full-time whistle and the Hammers had just about managed to hold onto their lead as Leicester looked to fightback.
In recent years, West Ham sides may have caved into the pressure and conceded an equaliser however there is a nerve of steel about Moyes' side this season.
Whilst they will be disappointed with the way they ended the game, it was another impressive result to add to their collection and could prove vital come the end of the season.