The 24-year-old came through the club's youth system and, after a loan spell at Leganes followed by a brief switch to Huesca, Lopez returned to Espanyol in 2013 before going on to play 33 times in the league.
The defensive midfielder is expected to cost around Napoli around €5 million and will slot into the berth vacated by Switzerland international Valon Behrami, who left Serie A for Hamburg during the close-season.
Lopez will be presented by the club upon the passing of his medical, which he is expected to complete on Sunday.
A statement on the Espanyol website read: "Early on Saturday morning, RCD Espanyol and SSC Napoli agreed terms for David Lopez's transfer.
"Due to this agreement, the Sant Cugat midfielder will fly to Italy today in order to undergo his medical and complete the transfer."
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.