The Gunners included a buy-back clause in the Mexican's sale that was expected to be activated this summer, but Sociedad have moved to negotiate a fee with Arsenal to cancel that agreement and seal Vela's long-term future.
The Liga side have reportedly paid £8.8 million, plus a further £4m in possible performance-related bonuses, to cancel the £3.5m agreement set in place when he was sold to Sociedad in 2012.
An official club statement read: "Real Sociedad have reached an agreement with Arsenal FC which will allow Carlos Vela to continue at the club on a permanent basis."
Vela has voiced his pleasure at being able to commit to Sociedad following speculation regarding his future and is now looking forward to preparing for the new season.
"I've always said that this is my home," he told the club's official website. "I am very happy in San Sebastian, which I told the president when he asked for my intentions.
"We knew it would not be easy, but thankfully it is resolved and all parties are happy," Vela told the club's official website.
"This club, this team has the ambition to make it better, and I am convinced that we will perform an exciting year.
"Now I get to enjoy my last days of vacation with my family to come with great force and to prepare this great year in the best way. "