The 26-year-old will join the Hammers on a free transfer when his contract with Real Betis expires on July 1, and the deal includes an option for a further two seasons.
Adrian has represented his hometown club since the start of his career, but is relishing the challenge of playing in the Premier League.
"I am extremely happy and ecstatic to have joined such a legendary and historical club in both London and in England," he told the club's website.
"I am really looking forward to being able to kick-off my career in the best league in the world with West Ham.
"I started off my career as a ten-year-old and have been there all of my life. I came through the ranks and I made my first-team debut in the sixth league game of last season against Malaga and was an ever-present since.
"For me, the icing on the cake was helping the team to qualify for the Europa League in, like West Ham, our first season back in the top flight after we had spent three years in the Second Division. Achieving this qualification was a massive farewell gift for the Betis fans."
One player who will not be playing alongside side Adrian is former England striker Carlton Cole.
The former Chelsea striker is heading out of Upton Park after the club confirmed he will be released at the end of the month.
Youngsters Jake Larkins, Jack Powell, Jami Rafati and Eoin Wearen will also depart on June 30, while experienced midfielder Gary O'Neil is still holding talks over a new deal.