City's recent shock back-to-back defeats to Crystal Palace and Leicester had allowed Liverpool to amass a commanding lead in their quest to win a first title since 1990.
But the champions now trail Jurgen Klopp's men by just four points thanks to Leroy Sane's winner 18 minutes from time after Roberto Firmino had cancelled out Sergio Aguero's first-half opener for the hosts.
"It was a final for us, because losing today it was almost over," said Guardiola.
"We are four points behind them and they are the leaders. We have to fight a lot, but this gives us a lot of confidence.
"I am proud of them (the players), but not just today. We lost two games in four days but you can't forget what they have done for 16 months."
With no more league meetings between the sides to come, Liverpool's destiny is still in their own hands, but they will now have the pressure of having a City side that romped to the title with a record 100 points last season on their tails.
"If somebody had told me after both games against Man City we would be 4 points up, I would have paid money," said Liverpool boss Jurgen Klopp.
"We never won it as a team so we want to finish the season as strongly as possible and we are still in a pretty good position."
City also had fortune on their side in a pulsating contest, particularly before the break.
Oly the finest of margins denied Liverpool the lead on 19 minutes when Sadio Mane burst onto Mohamed Salah's pass and saw his shot come back off the inside of the post.
John Stones then smacked his panicked clearance into City goalkeeper Ederson but the England international redeemed himself by clearing just before all of the ball had crossed the line.
City were also handed a reprieve by referee Anthony Taylor when captain Vincent Kompany only saw a yellow card for a wild two-footed lunge on Salah.
"I really like Vincent Kompany but how on Earth is that not a red card?" Klopp added. "If he hits Mo more he is out for the season."
At the other end Virgil van Dijk was again justifying his tag as the world's most expensive defender to keep City's array of attacking talent quiet with he Dutchman standing tall to block David Silva's effort.
However, a Liverpool defence that had not conceded twice in the same game all season in the league before kick-off was breached when City managed to free Aguero from Van Dijk's shackles.
The Argentine beat Dejan Lovren to Bernardo Silva's cross before firing into the roof of the net to score for the seventh time in seven home league games against Liverpool.
Despite a combination of nerves and fatigue at the end of a gruelling festive period, the game swung from end to end in the second-half.
One Liverpool full-back picked out another as for the visitors' equaliser when Trent Alexander-Arnold's cross was met perfectly by Andy Robertson to square for Firmino to head into an empty net.
Guardiola had his head in his hands when a slack pass from Sane set Liverpool free on the counter-attack moments later, but within seconds the German showed what he is capable of as he latched on Sterling's pass before firing in off the far post.
Alisson demonstrated why Liverpool spent a then world record £67 million for a goalkeeper in July to bolster their title chances with a brilliant save from Aguero as the Argentine tried to round him at the end of a blistering City counter-attack.
Seconds later it was the turn of his understudy in the Brazil side to make a huge save as Ederson denied Salah as tempers flared with Guardiola furious a free-kick wasn't awarded City's way before the Egyptian broke clear.
Sterling then wasted a great chance to ensure City didn't have to see out a tense five minutes of stoppage time, but the hosts held out to put the title back up for grabs.