Nadal was already assured of his place in the semi-finals but the result was crucial to decide which of Berdych or Stanislas Wawrinka would make it through with him.
Wawrinka had earlier beaten David Ferrer but victory for Berdych would have eliminated the Swiss despite two round-robin triumphs.
He might have been quietly confident given Nadal had beaten Berdych in their last 15 matches dating back to 2006, but the Czech put up a very good fight before a late collapse to lose 6-4 1-6 6-3.
Wawrinka will play Group B winner Novak Djokovic in the semi-finals on Sunday while Nadal will meet the winner of Saturday's match between Roger Federer and Juan Martin del Potro.
Nadal and Wawrinka are good friends, but the world number one said: "At the end I play for myself, for 200 (ranking) points. I am playing against a great player like Tomas. For me, to have a victory against a big player like him, on any surface, is important.
"So I went on court like if I am playing for qualification. It's true that after the first set I knew that I had already the first goal converted, being first in the group.
"But just winning a set, the only thing that I had was that. No points, no confidence if I didn't finish that match playing like I played. So it was important to finish that match the way that I did. I'm very happy for that."
Wawrinka would have been sitting quite comfortably during a first set in which Nadal broke in the opening game and was never threatened.
It all changed early in the second set, though, Berdych breaking for 2-0 when a stinging return forced the error on Nadal's forehand.
And remarkably after five games of the set the world number one had managed only four points.
The decisive game of the decider came at 3-4 when Berdych, who had served extremely well, threw in two double faults and was swiftly on his way to the exit door.
Nadal has lost both his previous meetings against Federer at the O2, winning just three games the last time they played here in 2011, while he was well beaten by Del Potro in Shanghai last month.
The Spaniard said: "If it is Del Potro, if is Federer, both players know very well how to beat me, on this surface especially.
"The first set was great today - my best set of the tournament. So that's the goal that I have."
Nadal, meanwhile, also addressed comments from Wawrinka after their match on Wednesday when the Swiss claimed Toni Nadal had been coaching his nephew before every point.
Coaching during matches is against the rules on the ATP Tour and Wawrinka had called on the umpire to issue a warning.
Nadal said: "Almost everybody has some talk with the coach during the match.
"The other day Toni was not coaching because he didn't tell me nothing in particular about tactics.
"I think three times after the point probably Stan heard it. I understand that Wawrinka got upset in that moment.
"After the match, Stan and Toni talked in the locker room. Wawrinka felt sorry because he did it in that way, and Toni felt sorry because Toni never had the intention of bothering Stan during the match.
"Wawrinka is one of the players that I have a better relationship with on tour. I feel sad during the match that he felt that way. That's why I told Toni to stop because the relationship is more important than any match."
Berdych will now turn his attention to next weekend's Davis Cup final between the Czech Republic and Serbia in Belgrade.
He said: "When you give Rafa two games, it's just too much. I gave him the first game of the match, and then the one that I lost my serve in the third set."
Wawrinka had to battle extremely hard to keep his hopes alive in the afternoon match, recovering from a set down to defeat already-eliminated David Ferrer 6-7 (3/7) 6-4 6-1.
The seventh seed insisted he would have been happy with his tournament had he made the semi-finals or not.
"Even if Berdych wins against Rafa, it's an amazing week for me already," said Wawrinka. "I had to win against Tomas Berdych, the number five, David Ferrer, I lost a tough one against Nadal.
"At the ATP World Tour Finals, it was quite a good level for me. That's the most important thing. I can be only really be happy with the tournament."