Royal Thai Police spokesman Krissana Pattanacharoen said more than 10 people had been killed. The total number of wounded was not immediately known.
The gunman appeared to be armed with an assault rifle, based on security camera video aired on Thai Rath television.
Thai Rath said the incident began at about 3.30pm, and appeared to be unresolved five hours later.
A police officer in the city of Nakhon Ratchasima said the soldier initially shot dead another soldier and a woman and wounded a third person, apparently over a land dispute.
City and neighbourhood police officers said the man took a gun from his base and drove to the Terminal 21 mall, shooting along the way. Several Thai media reported that he travelled in a military vehicle. Nakhon Ratchasima is also known as Korat.
Video taken outside the mall and shared on social media showed people taking cover in a car park as gunshots were fired.
The mall was shut down and the street outside was closed while authorities tried to arrest the gunman and rescue shoppers.
Defence Ministry spokesman Lieutenant General Kongcheep Tantrawanich identified the suspect as Sergeant Jakrapanth Thomma. He said police and military units had locked down the mall and the surrounding area.
The suspect posted messages on his Facebook page during the rampage, including "No one can escape death" and "Should I give up?".
In a later post, he wrote: "I have stopped already."
In one photo on the page, he is shown wearing a green camouflaged military helmet while a fireball and black smoke rage behind him.
Nakhon Ratchasima is about 150 miles north east of the capital Bangkok.
The Terminal 21 shopping mall is on a major road near the centre of the city, which is a hub for Thailand's relatively poorer and rural north-eastern region.
Gun violence is not unheard of in Thailand. Firearms can be obtained legally, and many Thais own guns. Mass shootings are rare apart from in the far south where authorities have for years battled a separatist insurgency.
The incident came a month after another high-profile mall shooting, in the central city of Lopburi. In that case, a masked gunman carrying a handgun with a silencer killed three people, including a two-year-old boy, and wounded four others as he robbed a jewellery store.
A school director was arrested less than two weeks later and reportedly confessed, saying he did not mean to shoot anyone.