Leicester maintained its push for a top-four spot by beating relegation-threatened West Ham 4-1 in the Premier League on Wednesday but lost leading scorer Jamie Vardy to an injury.

After back-to-back losses to Southampton and Burnley, Leicester looked back to its best as goals from Harvey Barnes, Ricardo and a brace from Ayoze Perez ensured the hosts maintained their hold on third place.

However, Brendan Rodgers' team had to endure a tense half-hour in the second half after West Ham captain Mark Noble made it 2-1 with a 50th-minute penalty. But Perez restored the two-goal lead with another penalty in the 81st before adding the fourth goal seven minutes later.

Leicester's Ayoze Perez celebrates after scoring his side's third goal during the English Premier League soccer match between Leicester City and West Ham Utd at the King Power Stadium in Leicester, England, Wednesday, Jan. 22, 2020. (AP PhotoRui Vieira)

Leicester's Ayoze Perez celebrates after scoring his side's third goal during the English Premier League soccer match between Leicester City and West Ham Utd at the King Power Stadium in Leicester, England, Wednesday, Jan. 22, 2020. (AP PhotoRui Vieira)

The bigger worry for manager Brendan Rodgers was seeing midfielder Nampalys Mendy and Vardy limp off in the first half.

Mendy hobbled off in the 32nd minute after pointing to a spot below his left knee, with Vardy following suit 12 minutes later after initially trying to play on with a left hamstring problem.

More AP soccer: https://apnews.com/Soccer and https://twitter.com/AP_Sports

West Ham's Pablo Fornals, left, Leicester's Caglar Soyuncu and Leicester's Ben Chilwell, right, challenge for the ball during the English Premier League soccer match between Leicester City and West Ham Utd at the King Power Stadium in Leicester, England, Wednesday, Jan. 22, 2020. (AP PhotoRui Vieira)

West Ham's Pablo Fornals, left, Leicester's Caglar Soyuncu and Leicester's Ben Chilwell, right, challenge for the ball during the English Premier League soccer match between Leicester City and West Ham Utd at the King Power Stadium in Leicester, England, Wednesday, Jan. 22, 2020. (AP PhotoRui Vieira)

Leicester's Ayoze Perez celebrates after scoring his side's third goal during the English Premier League soccer match between Leicester City and West Ham Utd at the King Power Stadium in Leicester, England, Wednesday, Jan. 22, 2020. (AP PhotoRui Vieira)

Leicester's Ayoze Perez celebrates after scoring his side's third goal during the English Premier League soccer match between Leicester City and West Ham Utd at the King Power Stadium in Leicester, England, Wednesday, Jan. 22, 2020. (AP PhotoRui Vieira)