United had a bid of £28.85million for the 24-year-old rejected earlier on Thursday but an improved, though undisclosed, offer was enough to secure his signature. The Spaniard also activated his £28m buy-out clause which would have risen to £32m after July 1 to facilitate the move.
Bilbao-born Herrera moved to his hometown club from Real Zaragoza in 2011 and made 128 appearances, scoring 11 goals.
The Red Devils attempted to sign the talented playmaker last summer but failed to complete the deal on deadline day, with reports suggesting the transfer had been interfered with by pranksters pretending to act on the club's behalf.
Then-manager David Moyes instead bought Marouane Fellaini, who endured a disappointing debut campaign and failed to solve the team's long-term problems in central midfield.
Herrera will be charged with bringing added control to United's midfield, where he will compete for a place with the likes of Michael Carrick, Tom Cleverley and Fellaini.
He has been capped by Spain at U20, U21 and U23 level and, while his move is still dependent on the receipt of the International Transfer Certificate, van Gaal's assistant Ryan Giggs was delighted the club had managed to get their man.
Giggs said: "Ander is a fantastic young player, with great energy and creativity. We believe him to be one of the brightest young prospects in Spain and I am certain he will be a big hit with the United fans.
"I'm delighted he has made the decision to come to Manchester and play his part in the club's future. I'm looking forward to seeing him in action on our summer tour to America."
Herrera said: "Signing for Manchester United is a dream come true. I have played at Old Trafford for Athletic Club in the UEFA Europa League and it was one of the highlights of my career so far.
"I have joined United to do all I can to help the team reach the club's objectives. Having arrived on Tuesday I'm excited to now be living in Manchester and I can't wait for my first game in United's famous red shirt.
"I will never forget my time with Athletic club and I'd like to thank the fans and staff for all their support and above all wish all my fantastic former team-mates all the best for the future."
@wexford_blue - yes, that's correct, it is far superior that way. Well observed sir! Unless you are being sarcastic in which case you obviously have little understanding of how a business works- naughtiusmaximu