The company is the first global partner that F1 has found since it took over the management of the organisation at the start of 2017.
It joins the five major players that came on board during the Bernie Ecclestone era, namely Rolex, Heineken, DHL, Emirates and Pirelli.
The deal includes title sponsorship of this year's Spanish, Hungarian and US GP, and is potentially the first step towards a race in Saudi Arabia.
F1 stressed that the deal fits with its sustainability push and that it will include research on alternative fuels and the next generation of power unit.
"We are delighted to welcome Aramco to the Formula 1 family as a long-term Global Partner as we start our 2020 season," said F1 CEO Chase Carey.
"We are looking forward to sharing our combined expertise and working with Aramco on technological innovation and we will benefit hugely from its capabilities and expertise in the fuel and energy sector."
Aramco President and CEO Amin H Nasser added: "As the world's largest energy supplier and an innovation leader, we have the ambition to find game-changing solutions for better-performing engines and cleaner energy.
"Partnerships like these are important to help us to deliver on our ambitions."