Well, it depends on what the objectives of said war was. If the US just wants to keep the Straight of Hormuz open, then yeah, they could easily do that since the rest of the Gulf Nations want to keep it open and dislike Iran immensely (seriously - Saudi Arabia? Oman? UAE? All of them HATE, HATE, HATE Iran with a passion and would co-operate with the US just to spite Iran). Plus, Iran's Navy is junk. It has no blue-water capability and it's mostly armed with surplus, ageing, obsolete Soviet-era weapons that the Russians sold to them as a joke. Iran has absolutely no capability to defend its ships against either the US Navy or the US Airforce, or, for that matter, the airforce and navy of its gulf-state enemies. The US might not even have to directly attack - it'll just give a couple of bombs to Saudi Arabia and let them do the work (which they would be very eager and happy to do. No joke: Saudi Arabia hates Iran and would be all too glad to blow up some Iranian ships. You have no idea how much they hate each other).
If you're talking about a full-scale invasion to depose the leader, then it'll go like Iraq. They could easily topple the Iranian Government since Iran's military isn't very strong and the people have no real love for Ahmadinejad. But the US certainly couldn't stay and Iran would descend into chaos with supporters of the Supreme Leader (different guy than Ahmadinejad) and supporters of the "green" opposition. But make no mistake: neither group would let the US stay or be happy with them. Sure, Iranians dislike their own government immensely - but it's a mistake to believe that they'd welcome the US with open arms. They are just as mistrustful (and rightly so!) of the US as they are of their own leaders. You have to be a cynic to stay sane in the Middle East, and most Iranians would view the US invasion with the uttermost cynicism. They'd be very mistrustful, or hostile, to the US.
While the US could certainly rain down bombs on Iran, it can't make Iran in its own image or install a puppet government. If Iran did try to close the Straight of Hormuz (which they've threatened to do before and they've never done except briefly during the Iran/Iraq War), then the world community would descend on Iran with the fury of a thousand suns. As much as the Chinese and the Russians love to stick their finger in Uncle Sam's Eye, they won't tolerate a halt in the flow of gulf oil. No nation will tolerate that, and they'd allow the US to do whatever it wanted to get the oil flowing.
But there's not going to be a war. The Iranian government isn't insane. Believe me, if they thought their army could go toe-to-toe with the US, they'd have invaded Iraq and attacked Saudi Arabia by now. They desperately want to. But they know their army has almost no offensive capability. They can defend themselves against their neighbours, but they know that if they tried to attack, they'd be decimated by NATO, The Saudis or even the Iraqis themselves. I'll tell you this straight up: Iran's most "advanced" jet fighter is a fleet of ageing F-14's that they can't even use anymore since they can't get spare parts. That's right: Iran's most advanced air fighter is from 1970 and they can't even get them operational. Iran has produced it's own domestic air-craft, but every military analyst has stated that it's just a clone of the old F-4 Phantom, a plane so ludicrously out-of-date that it'd be barely a threat. Iran doesn't have the logistics, technical infrastructure or industry to maintain and operate a decent air-force. Their planes are ageing or obsolete, and they have virtually no capability to replace them once they are destroyed. Their pilots have decent training but would be smart enough to abandon base in the event of a real war, as any attempt they'd make at fighting the US air force would be suicide.
The Iranians know that they could offer up stern guerilla and urban war-fare resistance. No, they know they can't "beat" the US conventionally, but they are content to know that if the US ever invaded, they'd make the US bleed. While Iran is no threat to its neighbours or the world community (until they get a bomb, and then that's a different story), don't make the mistake of assuming that any invasion would be "easy". Any invasion of Iran would be even more difficult and chaotic than the 2003 invasion of Iraq.
But as I've said: There's going to be no more. This is saber-rattling on Iran's part. They are making a big show and making provocative statements, because that's what they do. It's part of the game. They also said, about 2 months ago, that they'd send their fleet to blockade the US coast, which was a claim so laughable that no one paid attention to it. The US absolutely does not want to Invade Iran (they still remember how Iraq went down) and the Iranians are not stupid enough to think that they'd win in a conventional war waged outside its own borders (they'd be absolutely MASSACRED if they tried).