The aliens are all destroyed and the humans win thanks to putting the retired USS Missouri back into service to take them on.
Alex Hopper (Taylor Kitsch) is a drunk layabout who is arrested by the cops after breaking into a convenience store to get a burrito for a girl in a bar. His brother, fed up with his behaviour, makes him join the US Navy. Although Alex rises to Lieutenant Commander in the Navy over the next few years he remains a bit of a screw up, and after he gets into a fight with another officer the Admiral (Liam Neeson) tells him he will shortly be thrown out of the service. This is a bit unfortunate as Neeson's daughter Sam (Brooklyn Decker) is Alex's girlfriend, and Alex was about to ask Neeson for permission to marry her!
At that point aliens arrive on Earth, attracted by a signal some astronomers sent from a satellite to a distant star. One of the alien ships crashes into a different satellite on the way down and is destroyed.
The aliens enclose an area of the pacific in a big forcefield, trapping some islands and three Navy destroyers inside. Two of the ships are sunk in the first encounter, killing Alex's brother. Alex's own ship survives but the Captain is killed, leaving him in charge.
The aliens are an advanced force, looking to land on Earth and establish communications with home - unfortunately for them the destroyed ship had their communications system on it. So they capture some radio telescopes on one of the islands and begin to rig them to send a message home via the satellite in space.
Alex, manages to destroy three of the alien vessels before his ship is sunk. The survivors have nothing left to fight with, so they head to the island where the battleship USS Missouri is docked. They and some of the veterans visiting the ship put it back into service and sail out to battle the alien mothership. Although the battleship takes heavy damage Alex is able to show a new maturity and defeat the aliens, blasting their mothership to bits and blowing up their communications equipment on land before it can signal home.
Alex is awarded a silver star, and it seems he will be allowed to stay in the Navy and marry Sam.
FYI - Nobody at any point says the words "You sank my battleship!" - actually the Missouri, only battleship in the film, is never sunk.