City was the best team in the first 45 minutes even after losing Bayern Munich-linked Leroy Sane to injury, with Raheem Sterling giving it a deserved half-time lead with his first goal against Liverpool in his 11th outing against his old club.
Jurgen Klopp's side improved after the break and Joel Matip's leveller was just reward for its efforts, as City started to wilt in the warm conditions.
The excellent Claudio Bravo made sure the game went to penalties and proved to be the hero when he kept out Georginio Wijnaldum's effort, allowing Gabriel Jesus to seal victory with a successful spot-kick.
The blow of losing Sane just 11 minutes in was quickly forgotten as City made the most of the resulting free-kick, Liverpool's offside trap all over the place as David Silva flicked Kevin De Bruyne's cut-back across goal and Sterling forced the ball beyond Alisson.
City was in control but Liverpool could have levelled before the break had Mohamed Salah shown a touch of generosity, the forward clipping the outside of the post from a tight angle and then ballooning a second chance over the bar after a poor Oleksandr Zinchenko header, leaving Roberto Firmino angry not to receive a simple pass.
Guardiola then became the first Premier League manager to be booked on the touchline as he reacted furiously to a challenge from Joe Gomez on David Silva, the City boss suggesting the defender's boot had been dangerously high.
Sterling hit the base of the post, although any goal would have been ruled out for offside, as City started the second half strongly, with Guardiola and Klopp resisting the urge to make the most of the maximum six available substitutions at the break.
Liverpool suddenly threatened a leveller and was twice denied by the woodwork, Virgil van Dijk hitting the base of the crossbar with a half-volley and Salah firing against the foot of the right-hand post from the edge of the box.
Sterling then raced through on Alisson but dithered on the ball and the goalkeeper calmly took it back, and it proved a costly miss, with Matip nodding an equaliser past Bravo after Van Dijk picked him out in the six-yard box.
Bravo prevented Naby Keita and Salah from snatching late winners, and the latter was denied from another glorious chance as Kyle Walker's acrobatic clearance on the goal line forced a shootout.
Bravo saved comfortably from Wijnaldum's spot-kick, the only one that was missed, before Jesus confidently swept the ball past Alisson and sparked City celebrations.
City begins its Premier League title defence away to West Ham United next Sunday (AEST), while Liverpool kicks off the top-flight season 24 hours earlier at home to Norwich City.