The home side took the lead early in the second half when Sergio Aguero deflected the ball into the path of the offside Sterling, who went on to beat Ben Foster. Although the offside flag went up, the goal was allowed to stand because the ball touched Daryl Janmaat on its way to the England international.
Sterling went on to score another two goals by the hour mark to take reigning champions City four points clear at the top of the Premier League ahead of rivals Liverpool's clash with Burnley on Sunday.
And Guardiola acknowledged his side benefitted from a contentious decision from the referee, arguing that such mistakes will occur less often when video assistant referee (VAR) is introduced to the English top-flight next season.
"I thought it was not a goal because of the linesman’s decision and then the referee says it is," Guardiola told reporters. "With VAR we don’t have this problem, the Premier League decides against VAR, when all around the world we have it. Next season we won’t be having this conversation and we will be clear.
"In the beginning of the season we voted for VAR to help referees but many clubs didn’t want it and this kind of situation would be easier.
"In other games there are wrong decisions, goals are offside, dives make penalties, which is why VAR helps referees to make the job better. I am helped by my staff and referees need help from technology."
Although the coach said he was sorry to see his side take the advantage through an offside goal, he is convinced they deserved the victory at an important stage of the season.
"It is the end part of the season so every game is important. For three months we wait to be top of the league and now we have to try and win our games," he told BBC Sport.
"I am sorry if it is offside but we deserve to win. The opponent comes here - against Liverpool they tried to press but here they have 11 players in the box. Literally there is no spaces but we found it and we created a lot which is why we deserved to win.
"Today is not luck. We won because we were better, much better than the opponent. Here there are many people working to make last season’s level and if they can do that it will be down to hard work and not luck.
"With the second goal soon after it was easier but at the end with long balls they win the duels. Maybe Troy Deeney is the best player at holding the ball up but even with those situations we created on the counter attack two or three chances to win the game."