Media playback is not supported on this device
The victory helped United stay seven points clear at the top of the table.
Ferguson said: "Some of our defending after [our lead was halved] was a bit erratic and even desperate at times.
"But we managed to get through it. The name of the game is winning. There are moments where you have to defend. This was one of them."
United had opened up a two-goal lead through Robin van Persie and Nemanja Vidic before Daniel Sturridge pulled one back for the visitors.
Manchester United now have 55 points from 22 Premier League matches - this represents their highest tally at this stage of a top-flight season
Source: Infostrada
And Sturridge failed to convert a late chance as the home side held on for a win which maintained their advantage over second-placed Manchester City, who later won 2-0 at Arsenal.
"I would have taken that score [against Liverpool] before the game," said Ferguson.
"The first-half performance, and until we scored the second goal, was absolutely brilliant.
"It was as good a performance as we have had for a long time and we should have been three or four up, but when they got their goal they got inspired by it.
"Their supporters got going and it was hard work after that. I am just glad we won the match."
United are now 24 points ahead of eighth-place Liverpool, and before the game Ferguson had claimed he did not know where the Merseysiders were in the table.
But he added: "Winning against Liverpool is important. It doesn't matter where you are in the league.
"Manchester United-Liverpool games are fantastic challenges.
"They are the two most successful teams in the country. Today hopefully those three points will be very important."
Boss Sir Alex Ferguson admitted his relief after Manchester United withstood a late Liverpool rally to beat their Premier League rivals 2-1.