City moved back one point clear of Liverpool despite not being at their fluent best as centre-back Kompany unleashed a long-range shot into the top corner 20 minutes from time.
Guardiola's men will become the first side in a decade to retain the title at Brighton on Sunday as long as they match or better the Reds' result at home to Wolves.
Kompany, who has endured terrible luck with injuries over recent years, was in tears as he led a lap of honour with his children to mark City's final home game of the season and may have played for the last time at the Etihad with his contract expiring at the end of the campaign.
"There are players that help us to be where we are right now," said Guardiola. "Vincent is one of them.
"When is fit he is an incredible central defender. He is beloved, he is a leader. I'm happy for him, for the club, for everybody."
After edging past Newcastle 3-2 on Saturday night, Liverpool, who have not won the league since 1990, were left praying that former manager Brendan Rodgers could do them a favour at the Etihad.
Leicester's marked improvement since Rodgers took charge in February was on show in an impressive display from the visitors as City were made to sweat but just got over the line for a vital three points.
And Guardiola admitted he had urged Kompany not to shoot as he lined up his first goal from outside the box since he was playing for Hamburg in 2007.
"It's not about the amount of goals you score it's about when you score them. Today it was necessary," said Kompany.
- 'We have the pressure' -
"Every step in the last four months was significant. Liverpool keep making the steps and now we have a final to play in Brighton, Nothing is won yet."
City have now won 13 consecutive league games to overhaul a seven-point deficit at the top of the table in January and Guardiola claimed it is his side that have had to play under pressure despite Liverpool's 29-year wait to win the title.
"It was outstanding the way we played in the second-half. The character, the personality, knowing how difficult it is," added Guardiola.
"Right now Liverpool play without pressure. We have the pressure, we know we can lose it because it is in our hands."
Sergio Aguero came closest to opening the scoring before the break with a header that clipped the inside of the post and was palmed clear by Kasper Schmeichel.
Yet, it was not until after the break that City upped the tempo to lay siege on the Leicester goal.
City thought their moment had come when the ball fell kindly for Aguero inside the area, only for Schmeichel to make a miraculous stop.
Guardiola's men have now scored 157 goals this season but there will not be a more spectacular or unexpected one than that which may deliver the title.
Kompany looked short of options as he strode forward before unleashing a rocket of a shot that arrowed into the top corner.
"At the end of the season we are going to talk to him," said Guardiola on whether Kompany will be handed a new deal.
"He is an incredible human being. He helped me a lot since I've been here. Always we can count on him for his personality."
Leicester still had a huge chance to answer Liverpool's prayers three minutes from time.
But against his former club Kelechi Iheanacho shot wide with just Ederson to beat and a titanic tussle for the title remains in City's hands heading into the final day.
"He should score, I've said that to him afterwards," said Rodgers.
"We didn't have many chances, but the one that came he's got to score that."