Cristiano Ronaldo put the Spanish giants ahead after four minutes but Mario Gomez and Marcos Alonso reversed the scoreline and gave the Serie A side the winReal Madrid handed a first start to new goalkeeper Keylor Navas but the European champions were beaten 2-1 by Fiorentina on Saturday.
The Costa Rica international moved to Santiago Bernabeu from Levante earlier this month, but was overlooked in favor of Iker Casillas for Real's 2-0 UEFA Super Cup victory over Sevilla on Tuesday.
However, he was named in a starting XI for a friendly at the Stadion Narodowy, Warszawa, while Angel di Maria and Sami Khedira also started despite rumblings that the duo could leave Real.
Carlo Ancelotti's men made a bright start and Cristiano Ronaldo rounded off a swift break with the opening goal, but Mario Gomez equalized with a strong header just before the half-hour mark.
And the Serie A side secured a morale-boosting win thanks to a fine solo effort from Marcos Alonso.
Navas was called into action in the third minute, making a smart save at his near post from Khouma Babacar's well-struck shot.
Real then produced a blistering counterattack from Fiorentina's resulting corner to take the lead.
Ronaldo started and finished the move, bursting clear before picking out Di Maria, who in turn slid a well-placed pass to the back post where the Portugal forward was on hand to apply the finish into the gaping goal.
After a slow start the Italian side grew into the match and Gomez fired a warning shot with a strike from the edge of the box that went just wide, before he netted the equalizer in the 27th minute.
Alberto Aquilani found space on the right and picked out the Germany international, who thumped home his header from eight yards.
Real thought it had re-taken the lead when Di Maria collected Khedira's through ball in the area and finished well, but he was ruled to be in an offside position.
The La Liga giants then had another goal chalked off shortly after the restart.
Karim Benzema - one of four players to enter the fray at the break - received a deflected shot in the area and his left-foot shot beat Neto, but the France striker was adjudged to be offside.
Real continued to enjoy the better of the possession, but the tempo dropped significantly as the match wore on.
However, Alonso produced a moment of quality in the 69th minute as he beat two men on the left of the box before sliding a right-foot shot past Navas, with Nacho Fernandez unable to clear on the line.
Di Maria ought to have equalized, but got his finish all wrong when he attempted to chip the keeper and dragged his effort wide with his left foot.
That would prove to be Real's last chance and the Blancos will now look ahead to Tuesday's Supercopa de Espana first-leg tie with rival Atletico Madrid.