Spanish and European titleholders Madrid ended the International Champions Cup without a victory after three matches but Zinedine Zidane's side ensured they will carry some momentum into next week's UEFA Super Cup clash against Manchester United following Wednesday's friendly, which ended 1-1 at the end of regulation.
Borja Mayoral's deflected shot beat Stefan Frei in the 59th minute and that appeared to be the winner until Dom Dwyer pounced to convert a rebound with four minutes remaining to send the match to penalties.
But Dwyer had his penalty saved by Luca Zidane, while Giovani dos Santos rattled the crossbar as Madrid return to Europe with something to build on ahead of the Super Cup blockbuster in Skopje on August 8.
Zidane did not name his strongest starting XI as Gareth Bale, Karim Benzema, Luka Modric, Marcelo, Casemiro, Raphael Varane and Dani Carvajal were named on the bench, though captain Sergio Ramos, Toni Kroos, Isco and Marco Asensio featured from the opening whistle.
There was a reunion for 2007 Ballon d'Or winner and former Madrid midfielder Kaka, who spent four years at the Santiago Bernabeu and won LaLiga. The All-Star line-up also featured World Cup winners David Villa and Bastian Schweinsteiger, as well as ex-Juventus forward Sebastian Giovinco.
Tim Howard was forced into a save to deny Asensio in the 21st minute, while team-mate and first-team hopeful Mayoral – back at Madrid following a season-long loan spell at Wolfsburg – tried his luck from distance six minutes later.
Kroos threatened to break the deadlock past the half-hour mark, almost curling a shot inside the far post as Madrid controlled proceedings.
The All-Stars nearly snatched the opener moments later following a delightful run from Kaka, who drove into the penalty area and squared the ball to Villa but the New York City captain's shot was turned around the post after a fine reflex save from Keylor Navas.
Ramos showed his ability as an attacking force, pushing up into an advanced area and cheekily chipping narrowly over the crossbar approaching half-time.
The game's first goal eventually came just shy of the hour-mark thanks to Mayoral, albeit with some help from a deflection.
Played in by substitute Dani Ceballos – a signing from Real Betis – Mayoral showed his strength and composure to give Madrid the lead.
It was almost 2-0 in the 65th but substitute Benzema was unable to get past Frei – who replaced Howard at the interval – while Bale also came off the bench and flashed a low shot just past the post.
The All-Stars were limited in their opportunities, though they managed to get in behind Madrid's defence as the league's leading scorer Nemanja Nikolic found the side netting.
Just as Madrid were preparing to celebrate, the All-Stars scored with four minutes remaining after Dwyer was on hand to tuck away the rebound following Dax McCarty's thunderous header, though the Spanish giants were not to be denied on spot-kicks thanks Benzema, Bale, Mateo Kovacic and Marcelo.