City's Bernardo Silva and Mateo Kovacic both misfired in the shootout to put Madrid in the driving seat
The 24-year-old, who had been strongly linked by British media with a move to Manchester United earlier in the transfer window, helped Madrid win a second successive Champions League title last season.
"Chelsea Football Club and Real Madrid have agreed terms for the transfer of Alvaro Morata to Stamford Bridge," the club said in a statement.
He spent much of the season, however, as a substitute.
British media reports said Chelsea would pay around 70 million pounds ($91 million) for Morata.
($1 = 0.7675 pounds)