The man had rushed toward a group of soldiers and guards in the Carrousel du Louvre, the underground plaza adjoining the museum, according to Paris police Chief Michel Cadot. Wielding the weapon, the man shouted "Allahu akbar," Cadot said. The Arabic phrase translates to "God is greatest."
The soldier fired five shots in response.
The attacker was wearing two backpacks and may have had a second weapon, Cadot said. He was seriously injured by a bullet to the stomach. One soldier was slightly injured on the scalp.
No explosives were found in the backpacks of the man, who was conscious when he was taken into custody, Cadot said.
The attacker has been taken to a hospital for treatment, CNN's French affiliate BFM-TV reported.
Authorities have described him as a 29-year-old Egyptian and resident of the United Arab Emirates, but are withholding his name. He was issued a tourist visa in Dubai on November 8 and arrived in Paris on January 26, authorities said.
Another person was arrested, the French Interior Ministry said, although it was not immediately clear whether he or she was connected to the attack.
Prime Minister Bernard Cazeneuve described the attack as "terrorist in nature." The Paris prosecutor announced a terror investigation
About 250 visitors who were in the Louvre at the time were taken to a secure area. They were evacuated in small groups after checks were carried out, as police sought to make sure no one else was involved in the attack.
A security cordon was set up after the incident, which began at 10 a.m. (4 a.m. ET.)
President Francois Hollande praised the response to the attack, tweeting: "I salute the courage and determination showed by the military this morning at the Carrousel du Louvre."
Interior Minister Bruno Le Roux hailed the police and military for their calm and professionalism in subduing the attacker -- and said the incident was a reminder of the current threat.
He tweeted that he was meeting with security officials in Paris before visiting the injured soldier in hospital.
The mayor of Paris, Anne Hidalgo, said: "In this context of terrorist threat that concerns every big city in the world, we saw how efficient and relevant Paris security features were."
US President Donald Trump tweeted: "A new radical Islamic terrorist has just attacked in Louvre Museum in Paris. Tourists were locked down. France on edge again. GET SMART U.S."
Taylor Walstrum, a junior at the University of Georgia, was visiting the Louvre with some of his classmates while on a study abroad program in Italy -- and was among those caught up in the lockdown.
"We were at the Mona Lisa when alarms started going off, and the staff began frantically ushering us out," he told CNN over Twitter.
He said staff led people down to the basement and said police were sweeping the grounds, but didn't tell them what was happening. Then they moved the group to another room, where they waited for two or three hours.
"[We] weren't told anything other than the inside of the museum was secure, had to rely on outside news, which was very frustrating," he said.
Walstrum said that authorities searched their bags, and then everyone was patted down by armed guards before they were allowed to leave.
"At which point we were let out of the museum and allowed to roam free," he said. "Lots of sirens but we got away from there as quickly as we could."
As the incident unfolded, a music producer from Florida tweeted that "something is going down" at the Louvre, adding that he saw "30 National Police vehicles with guns drawn."
The Louvre said it would reopen on Saturday.
State of emergency
Voted the most popular museum in the world in 2016, the Louvre is home to the Mona Lisa, the Venus de Milo and the Code of Hammurabi, among other famous works.
Louvre attendance has fallen by 21% over the past two years, with 7.3 million people visiting the museum in 2016 compared to 9.3 million in 2014.
A state of emergency has been in place across France since the Paris terror attacks in November 2015
, in which 130 people were killed and hundreds injured. In January that year, 17 people were killed in attacks in Paris on the satirical magazine Charlie Hebdo and at a kosher grocery store, and in the Paris suburb of Montrouge.
Last July, a radicalized Tunisian plowed a 20-ton truck into crowds on the Promenade des Anglais in Nice during a Bastille Day celebration, killing 86 people and injuring 200 others.
Authorities continue to monitor thousands of suspected Islamist radicals.