The Edinburgh side gave Manuel Pellegrini’s side the perfect work-out and the Blues had to earn their first victory of pre-season in front of a capacity 12,188 Tynecastle crowd.
As was the case at Dundee, City played virtually two different sides in each half to give the whole squad much-needed game time and each team performed well in an entertaining game.
Hearts, who begin their season against Annan this weekend, were compact and sharp, but the Blues were more than a match with the triple training sessions starting to pay off.
The hosts held firm until the 25th-minute when Alvaro Negredo’s clever reverse pass put Scott Sinclair clear and the City forward tucked the ball home calmly past Neil Alexander to the delight of more than a 1,000 travelling Blues.
Ten changes were made at the break by City with only Sinclair retaining his place, but Hearts were level on 56 minutes when the impressive Dale Carrick put Osman Sow through on goal and the former Crystal Palace striker planted the ball past Willy Caballero with a well-placed shot.
As the half wore on, however, the Blues looked increasingly more dangerous with John Guidetti and Stevan Jovetic a handful up front and Emyr Huws and Sinclair a constant threat.
And it was Huws who won what would prove to be a decisive penalty after 80 minutes when a slick move involving Jovetic and Gael Clichy saw the French full-back whip in a cross that Guidetti failed to connect with – but the ball fell to Huws who controlled the ball and was brought down by Callum Paterson to give the referee an easy decision.
Aleks Kolarov planted the ball home from the penalty spot to make it 2-1 and earn City a satisfying victory against a Hearts side who are sure to be challenging for promotion this season.