BEIJING — An American businesswoman from Houston was sentenced to three and half years in prison in China on spying charges on Tuesday, over two years after Chinese security officers spirited her away and 20 or more years after the alleged espionage was said to have taken place, her lawyer said.

But the businesswoman, Phan Phan-Gillis, often called Sandy, may soon be deported to the United States, allowing her to reunite with her husband, Jeff Gillis, who has adamantly rejected the accusations and fought for her freedom, said her lawyer, Shang Baojun.

After a secret trial in the morning in Nanning, the capital of the Guangxi region in southern China, a judge declared Ms. Phan-Gillis guilty, sentenced her and ordered her expelled from China — but left unclear whether she had to serve out her prison sentence before being deported, Mr. Shang said by telephone.

“A court can order expulsion from the country for foreign nationals either after serving a sentence or concurrent with a sentence starting, but the judge wasn’t clear on which applied here, so I also have to wait to read the verdict,” Mr. Shang said. “Of course, I hope that they’ll deport her as soon as possible, but we have to wait until we see the written verdict to be sure.”