El Shaarawy bagged his brace in the 45th minute with a header after Moldova's defender Veaceslav Posmac's error.
Mikel Oyarzabal's 13th minute goal gave the Spaniards the win that means they have seven points from their opening three matches in the competition after previously drawing in Germany and beating the Ukraine (who they play again on Tuesday).
"It was a tough match. We didn't play at our level in the first quarter, but changed our tactics in zone defense from the second quarter," said Shanxi coach Li Ge.
Both sides traded the advantage in the second quarter before Zhejiang went on a late scoring run to race ahead 49-44 at the interval.
The match, played behind closed doors at Sammy Ofer Stadium in the northern city of Haifa, saw a strong start by the visitors, who missed several opportunities early.
Spain took the lead thanks to its efforts to pin the Swiss back when Granit Xhaka slipped as Yann Sommer tried a short pass out from goal. Mikel Merino collected the ball and fed his Real Sociedad teammate Oyarzabal to beat Sommer on the turn in the 13th minute.
The clash will be a replay of the 2019 Copa America final, which Brazil won 3-1 at the Maracana stadium in Rio de Janeiro.
"A professional player's career could be short, but in this way, football will always be a part of my life," she said.
"We have to always improve," Casemiro told reporters. "Douglas came in and did well but we'll get better as we adapt with every game," the 28-year-old added.
Xi'an, home to the Terra-Cotta Warriors and Horses, attracted 30,000 runners from 30 countries and regions to participate in its third marathon edition in 2019.
Ji was dubbed "Female Kobe" for her shooting posture and scoring ability similar to deceased American legend Kobe Bryant, who was killed in a helicopter crash in January.