"The lads did really well tonight. After their first goal and then the expulsion it could have gone very differently," Ancelotti said.
The result lifted Milan to fourth place in Serie A, with seven points from four matches.
The home side took the lead in the 37th minute, when defender Fernando Couto headed in at the far post.
Eight minutes after the interval Milan midfielder Massimo Ambrosini was shown the red card for elbowing Massimo Oddo in the face.
Briefly Lazio appeared to have gained control of the game, but two goals in four minutes by Ukrainian striker Andriy Shevchenko secured victory for the champions and averted their second defeat in five days after losing to promoted
"The important thing is that we didn't lose our heads and we stayed in the match," Ancelotti added.
"We're not yet at our best, but the team has huge potential. Tonight they showed determination and a great desire to win.
"I believe we'll be in contention for the title again this year."
Lazio coach Domenico Caso, meanwhile, said his team's performance had been marred by a momentary lapse of concentration.
"With their first goal we made a fairly naive mistake on a corner to lose track of Shevchenko. That shook us up and we got a bit distracted," he said.
"Up until that point, though, I thought we'd played a great match. Despite the defeat we can take a lot of positives out of tonight.
"We held our shape well and matched Milan for long periods of the game."