Massa has been with Ferrari for eight years and came close to winning the drivers' championship in 2008, losing out by a single point to Lewis Hamilton for McLaren.
His future was in doubt after Ferrari announced they had re-signed Kimi Raikkonen to partner Fernando Alonso from 2014, but Massa will remain in Formula One for a 12th successive season after penning a deal with Williams.
The team have confirmed Pastor Maldonado will make way for Massa, with Valtteri Bottas remaining with the team to partner the Brazilian.
Massa, who recently expressed his concern at the idea of drivers being handed drives due to large sponsorship backing, first entered Formula One with Sauber in 2002.
He was given a send-off by Ferrari at their Mugello track on Sunday and is now looking forward to starting a new period of his career.
"Williams is one of the most successful and important teams of all time in Formula One," said Massa.
"When I was a kid, I always dreamed about racing for Williams, Ferrari or McLaren and I'm glad to be signing with another icon of the sport following my time at Ferrari."
Massa will be following in the footsteps of compatriots Nelson Piquet, Aytron Senna and Rubens Barrichello in racing for Williams and is relishing the challenge.
"With such a major change of regulations in 2014, I hope my experience will be useful in helping the team in its effort to move on from a difficult period," he added.
"It is also nice to remember that some of the best Brazilian drivers raced for Williams and cemented a strong national link with the team. I'm highly motivated to start working hard from the very beginning in what is an exciting new challenge in my career."
Team principal Sir Frank Williams also hailed the arrival of Massa and was quick to praise Bottas, whose services have been retained despite the Finn not yet scoring a point for the team.
"We are delighted to be able to confirm our 2014 driver line-up and welcome Felipe into the Williams family," he said.
"Massa is an exceptional talent and a real fighter on the race track; he also brings a wealth of experience as we begin a new chapter in our story.
"Valtteri is a valued member of the team and I'm pleased he was able to demonstrate his talent in tricky conditions in Montreal [where he qualified third on the grid]. There is much more to come from him."
Maldonado was expected to leave the team and could yet find himself filling the seat at Lotus which has been vacated by Raikkonen's switch to Ferrari.