The visiting Hammers produced a fine performance capped with goals from Michail Antonio, Pablo Fornals and Jarrod Bowen.
The Hammers climbed to sixth on six points with their first away win of the season.
Following their impressive 5-2 win at Manchester City a week ago, Leicester City were brought crashing down to earth against the visitors, who could have won by a bigger margin.
Antonio headed West Ham into a 14th minute lead as he rose at the far post to meet a long Aaron Cresswell cross and steer the ball into the opposite corner.
He shot from eight metres out, after holding off two defenders.
Bowen then put the icing on the cake with a clinical finish in the 83rd minute, courtesy of a defence-splitting pass by Fornals.