A dramatic coup for the billionaire as he seeks to unlock the social network's "extraordinary potential" was announced by the company on Monday.
Musk will pay $54.20 per share, which is the same amount as his original offer.
After securing $46 billion of financing to back the deal, the two parties met on Sunday.
Musk tried to buy the company but it was resisted by the board. It put up a poison pill to block attempts at a hostile takeover after Musk rejected its offer for a board seat in exchange for limiting his maximum investment.
The deal is expected to close in 2022.
In announcing the acquisition, Musk said he wants to make the service better than ever by enhancing the product with new features, making it open source to increase trust, and authenticating all humans.
According to the terms of the deal, Musk paid a 38.8% premium over the closing stock price of the company. Since November 2021, it has not traded at $54.20.
After Musk disclosed a 9% stake in the company in early April, the stock price of the company went from around $40 per share to over $50 per share. The price went up again on Monday as word spread that the board of the micro-blogging site was going to accept Musk's offer, before being halted on Monday afternoon.
Please check back for more updates.