City were the best team in the first 45 minutes even after losing Bayern Munich-linked Leroy Sane to injury, with Raheem Sterling giving them a deserved half-time lead with his first goal against Liverpool in his 11th outing versus his old club.
Jurgen Klopp's side improved after the break, though, and Joel Matip's leveller was just reward for their efforts, as City started to wilt in the warm conditions.
The excellent Claudio Bravo made sure the game went to penalties and proved the hero when he kept out Georginio Wijnaldum's effort, allowing Gabriel Jesus to seal victory.
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 were 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 were 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.
3 - Three of Joel Matip's four goals for Liverpool have been scored in London (Selhurst Park, London Stadium, Wembley), with three of the four also coming from headers. Capital. #CommunityShield pic.twitter.com/1DHnHgkJAu— OptaJoe (@OptaJoe) August 4, 2019
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 shoot-out.
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.
What does it mean? Little to split the Premier League's top two
City claimed the bragging rights and were certainly the better side early on, but this was another indicator that their league title crown will come under serious threat this season.
Liverpool have not had a particularly encouraging pre-season and there were similar problems laid bare here. The usually imperious defence looked uneasy, Roberto Firmino is short of sharpness and the place for Divock Origi is not wide on the left.
That said, they outplayed City after the break and really should have won in normal time. They look ready to push Guardiola's men all the way again in the top flight.
City's first choice in pre-season while Ederson had an extended break, Bravo was the only reason Liverpool did not win the game in normal time. He then saved Wijnaldum's penalty to secure the trophy.
Liverpool seemed to target Zinchenko and there were times when it was easy to see why. He was outmuscled by Salah too often, twice headed straight to red shirts within 20 yards of his own goal, and it was his foul that led to the equaliser.
Key Opta facts
65 - During the Community Shield final, Virgil van Dijk was dribbled past for the first time in his last 65 competitive appearances (by Gabriel Jesus) for @LFC since Mikel Merino did so for Newcastle in March 2018. Human. #CommunityShield pic.twitter.com/24B6WFcKUw— OptaJoe (@OptaJoe) August 4, 2019
- Manchester City are the first side to win the Community Shield having won both the Premier League and the FA Cup in the previous season since Arsenal in August 2002 (beating Liverpool 1-0).
- Including penalty shootout defeats, only Manchester United and Chelsea (nine each) have ended up on the losing side on more occasions in the Community Shield final than Liverpool (seven – level with Arsenal).
- In all competitions, Man City have won just two of their last 13 meetings with Liverpool (D4 L7), however they are unbeaten in their last three games against the Reds (W1 D2).
- Manchester City are unbeaten in their last eight games at Wembley Stadium since losing to Arsenal in the 2017 FA Cup semi-final (W6 D2), the longest ongoing such unbeaten run among club sides.
- Manchester City’s Raheem Sterling has been directly involved in seven goals in his last four appearances for club and country at Wembley Stadium (six goals and one assist).
City begin their Premier League title defence away to West Ham on Saturday. Liverpool kick off the top-flight season on Friday at home to Norwich City.