The goalkeeper was one of the best performers in La Liga last season with Levante and followed up his stellar 2013-14 by starring with Costa Rica at the World Cup, reaching the quarter-finals thanks to his heroics between the sticks.
Levante president Quico Catalan confirmed last week that his club were in talks with Real over a potential transfer and the European champions have now completed the formalities of the deal.
A statement on their official website read: "Real Madrid CF and Levante UD have reached an agreement for the transfer of the player Keylor Navas, who is linked to the club over the next six seasons.
"The player will be presented on Tuesday, August 5, at 13:00CET at the Bernabeu, after undergoing the relevant medical examination."
Navas, 27, was Levante's first-choice goalkeeper last season, having previously played second fiddle to Gustavo Munua at the Valencia-based club.
During the World Cup, he kept clean sheets against England and Italy, before also remaining unbeaten for 120 minutes against the Netherlands, who ultimately saw off Costa Rica in a penalty shoot-out to reach the semi-final.