Alvaro Odriozola and Cristo Gonzalez added the gloss in the closing stages.
Solari, the boss of Real's Castilla B team, was handed the reins of the A team on Monday following the sacking of Julen Lopetegui.
The 52-year-old Spaniard was appointed in July but his tenure came under scrutiny following three losses and two draws in Madrid’s first nine La Liga games.
A 5-1 mauling at arch rivals Barcelona on 28 October sealed Lopetgui’s fate.
"In tough times, we are all pulling in the same direction," said Solari after the victory at Melilla. "We have a team of great champions who know what to do to get the job done."
Solari said on Tuesday that he was open to becoming the coach on a long term basis. The 42-year-old Argentine, who spent five years playing for Madrid between 2000 and 2005, is likely to remain in post for Real's La Liga game at home to Real Valladolid on Saturday.