The suspect is believed to be 26-year-old Esteban Santiago, an Iraq war veteran.
The motive is under investigation, but officials said he probably acted alone.
US media said the man might have been mentally disturbed. He reportedly said the government was controlling his mind and made him watch jihadist videos.
The attacker opened fire at the baggage claim area of Terminal 2 as passengers were collecting their luggage. Witnesses said he walked along the carousals and did not say anything as he shot people as they tried to run or hide.
He surrendered to police when he ran out of ammunition, witnesses added.
The statistics behind US gun violence
Why does US gun culture run so deep?
The man, who was wearing a Star Wars T-shirt, had travelled from Alaska, officials said, and checked in an unloaded gun and ammunition with his luggage. He loaded the weapon in the bathroom after landing and collecting his bag.
He was arrested unharmed, Sheriff Scott Israel said. "At this point, it looks like he acted alone," he said.
The suspect was in possession of a military ID which suggested he was a former member of the Puerto Rico and Alaska National Guard. He served in Iraq from April 2010 to February 2011, and ended his service in August 2016, according to the Pentagon.
US media reported that he received a general discharge from the Alaska National Guard for unsatisfactory performance.
An unnamed official told AP news agency that he walked into the FBI office in his hometown of Anchorage, Alaska, in November to say that the US government was controlling his mind and making him watch videos from so-called Islamic State (IS).
Agents questioned him and called police, who took him for a mental health evaluation, AP added. The official quoted said Mr Santiago did not appear intent on hurting anyone.
His brother said he had been receiving psychological treatment recently.
Flying with firearms is legal in the US as long as the guns are kept in a locked, hard-sided container as checked baggage only, under rules of the Transport Security Administration (TSA). Ammunition is allowed only in checked luggage.
The attack was the latest in a series of mass shootings in the US in recent years, carried out by people who said they were inspired by jihadist groups, loners or mentally disturbed, who had easy access to weapons under US gun laws.
Last year, in the worst shooting in recent US history, a man, apparently inspired by IS, killed 49 people at a gay nightclub in Orlando, Florida.(BBC)