Serbia warmed up for this year's U20 European Championship with a game against China at the Stankovic Cup.
Yao Ming played for the Chinese and had 11 points in a 96-72 win over the Serbians.
The captain of Serbia, Dusan Katnic, said his team benefited from playing against Yao.
"It was an honor," Katnic said.
"You don't play against Yao every day and it was a great experience that will make us a better team."