Carlos Protesoni and Kike Garcia scored two goals in two minutes in the final stages but Real Madrid held on.
Spanish champions Real Madrid earned a 3-0 win over Real Valladolid in La Liga on Sunday as Kylian Mbappe made his Santiago Bernabeu bow without finding the net.
VAR chalked off a Marquinhos goal for offside, as Costa Rica earned a point.
Brazil snatched a late leveller to share an entertaining and occasionally heated 3-3 friendly draw with Spain on Tuesday as youngsters Lamine Yamal and Endrick dazzled.
Brazil is unparalleled when it comes to footballing success and fervour, and for many the sport itself is synonymous with the Brazilian national team
Aged 17 years and 246 days, Endrick is the youngest senior international goal-scorer at Wembley.
Compact, fast and ingenious with the ball, Endrick has already racked up an impressive list of accolades since making his professional debut at 16.