The US has warned in recent weeks of a threat from Iran but has not given any details.
Tensions between the two nations have risen sharply since Donald Trump won the US presidency.
President Trump last year unilaterally withdrew the US from a nuclear deal with Iran and five world powers.
On Sunday, Mr Trump tweeted: "If Iran wants to fight, that will be the official end of Iran."
The US has in recent weeks deployed additional warships and military jets to the Gulf, on Iran's southern coast.
President Trump's national security adviser, John Bolton, is a long standing public advocate for regime change in Iran and has previously called for the US to bomb the nation.
Media captionThe BBC’s Paul Adams looks at the recent developments behind the US-Iran tensions
Mr Shanahan told reporters at the Pentagon: "I think our steps were very prudent and we've put on hold the potential for attacks on Americans and that is what is extremely important.
"I'd say we're in a period where the threat remains high and our job is to make sure that there is no miscalculation by the Iranians."
Iran has kept to the terms of the Joint Comprehensive Plan of Action (JCPOA) - the 2015 deal which limited the scope of its nuclear programme, and has called on other parties to uphold the deal despite the US withdrawal.
But the JCPOA looks to be increasingly under threat. Iranian officials said on Monday that they had increased by fourfold the production of low-enriched uranium - although the increase remains for the moment within the restrictions of the deal.
What is behind the escalation?
Tensions began rising earlier this month when the US ended exemptions from sanctions for countries still buying from Iran. The decision was intended to bring Iran's oil exports to zero, denying the government its main source of revenue.
Mr Trump reinstated the sanctions last year after abandoning the nuclear deal.
Days after the US withdrawal, Iranian President Hassan Rouhani said his country would suspend several commitments under the deal and called on European nations to back the nuclear agreement.
The White House then announced that the US was sending an aircraft carrier, B-52 bombers and a Patriot missile defence battery to the region because of "troubling and escalatory indications" related to Iran.
Last week, four oil tankers in the Gulf of Oman were damaged in what the United Arab Emirates said were sabotage attacks while drone attacks on two oil pumping stations in Saudi Arabia by Yemen's Houthi rebels - who are supported by Iran - forced the temporary closure of a pipeline.
Iran has denied that it was behind the incidents.
There were also unconfirmed reports, citing US and regional security officials, that Iran had loaded missiles on to boats in Iranian ports and that Iran-backed Iraqi paramilitary fighters had positioned rockets near facilities in Iraq used by US troops.
What are other countries saying?
"I would say to the Iranians: do not underestimate the resolve on the US side," UK Foreign Secretary Jeremy Hunt told reporters in Geneva on Monday. "They don't want a war with Iran. But if American interests are attacked, they will retaliate."
Features
Echoes of Trump in Modi's border politics
Niki Lauda: 'A remarkable life lived in Technicolor'
China's latest weapon in the trade war: Karaoke
Why a Danish tycoon bought the Highlands
Video
How a new diet for gassy cows is helping the environment
The man killed for sitting on a chair to eat
Why Israel distrusts Europe
The pun-loving computer programs that write adverts
Are barcodes the way to protect dementia patients?
Elsewhere on the BBC
Lyrics quiz
Have you been getting these songs wrong?
Full article Lyrics quiz
Feeling hot
What happens to your body in extreme heat?
Full article Feeling hot
Most Read
1 Brexit: PM says MPs have 'one last chance' to back her deal
2 Jamie Oliver restaurant chain collapse costs 1,000 jobs
3 Holidaymakers hit as pound slides
4 Dead James Bond extra Eric Michels 'targeted on Grindr'
5 Vibrator prize for Spanish squash champion spurs sexism debate
6 Cardiff woman's purse contents returned after 10 years
7 Nigel Farage to be examined over £450,000 payment from Arron Banks
8 London Bridge attack inquests: US tourist 'flatlined twice' after being stabbed
9 Female-voice AI reinforces bias, says UN report
10 Jordan Adlard Rogers inherits Penrose Estate after DNA test
Advertisement