Raheem Sterling opened the scoring for City in the 12th minute but the Reds rallied and levelled with quarter of an hour to go through Joel Matip.
Gabriel Jesus kept his cool to net the decisive penalty as the Premier League winners triumphed 5-4.
City boss Pep Guardiola told BT Sport: “An incredible final from both sides. No team can dominate for 90 minutes.
“We had real good moments. In the last 15 minutes we were exhausted and they had chances to win the game.
“It was a good test for both teams. It’s nice for the players to realise what they will face this season. At this level the difference is nothing. One penalty, one point.
“Manchester United will be back, Arsenal, Tottenham and Chelsea… I don’t know what will happen.”
Liverpool boss Jurgen Klopp wasn’t too disheartened by the defeat, with the league season set to commence next weekend.
“The least we deserved was the equaliser, one save decided it and I cannot be disappointed today,” Klopp said.
“The performance was much more important than a win. We know we are still here, we can still play proper football.”