The 21-year-old Spaniard spent the 2013-14 season on loan at Goodison Park and made 29 appearances, scoring three Premier League goals.
"Gerard needs no introduction to anyone here at Everton, for we are all well aware of his incredible footballing talent," Everton manager Roberto Martinez told the club's website.
"We got to know him really well from his loan period, not only as such a talented player but also his great character. He will be a fantastic asset to our club."
The contract includes a release clause if Barcelona make an offer meeting certain requirements within the first two years, and the European champions also have a right of first refusal if the Premier League club decide to sell Deulofeu, Everton said.
Deulofeu, who spent last season on loan at Sevilla, is Everton's second signing of the close season following the arrival of midfielder Tom Cleverley from Manchester United on a free transfer.
Image: Gerard Deulofeu
Photograph: David Ramos/Getty Images
EPL PHOTOS: Burnley relegated, Man United consolidate fourth spot
'Football will never change, it will always be about winning'
Happy Birthday Messi! The legend turns 28
'Improving the current Real Madrid squad is immensely difficult'
EPL PHOTOS: Leicester surprise again, Man City win