The missile was brought down near King Khaled International Airport on the northern outskirts of the city and did not cause any casualties, state-owned Al Ekhbariya TV reported.
Rocket fragments fell near the airport grounds, but flights were not disrupted, the Saudi Civil Aviation Authority said.
Yemen's Houthi rebels fired the missile across Saudi Arabia's southern border, according to several Houthi-owned media outlets, including Al-Masirah and SABA.
It is the first time a Houthi missile has come so close to a heavily populated area and appears to be the farthest such a missile has reached inside Saudi Arabia. Riyadh is around 620 miles (1,000km) north of the border with Yemen.
Saba News, which is run by the Houthi rebels, reported the missile was a Burkan H2 and the airport had been the target.
A Saudi military spokesman condemned the attack in a statement, saying the missile was fired "indiscriminately" toward a populated civilian area.
Saudi Arabia is part of a coalition carrying out bombings of the Iran-allied Houthi movement in Yemen, which has taken over the capital Sanaa and other parts of the country during its civil war.
Responding to the attack, Mr Trump immediately blamed Iran.
"A shot was just taken by Iran, in my opinion, at Saudi Arabia. And our system knocked it down," the US President said, referring to the Patriot missile batteries Saudi Arabia has purchased from the US.
"That's how good we are. Nobody makes what we make and now we're selling it all over the world."
Saudi military forces have intercepted missiles fired by Houthis several times since March 2015, when a Saudi-led coalition launched a war against the rebels and their allies after they captured northern Yemen and ousted the Saudi-backed president from power. The kingdom has also imposed an air and sea blockade on Yemen.
The stalemated war has killed more than 10,000 civilians and displaced three million others, pushing the Arab world's poorest country to the brink of famine.
Saudi Arabia accuses its rival, Iran, of training and helping arm the rebels. Iran denies it has provided material support, though it acknowledges its political support of the Houthis.
News outlet Al-Masirah said the missile was made in Yemen and was the third to be fired toward Riyadh this year. It reported the rebels saying the missile was fired in response to "Saudi-American aggression and crimes against the people of Yemen."
Earlier this week, a suspected air strike by the Saudi-led coalition killed at least 29 people, including children, in northern Yemen.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies