FORT LAUDERDALE, Fla. — A Chinese businesswoman who unlawfully made her way into President Trump’s Mar-a-Lago resort earlier this year with a purse full of electronics was sentenced on Monday to eight months in prison.

Because Yujing Zhang, 33, has already been in custody for more than seven months, since March 30, she could be out in a matter of days. Judge Roy K. Altman of the United States District Court for the Southern District of Florida ordered her deported upon her release.

Prosecutors had asked for an 18-month sentence for Ms. Zhang, who was convicted of trespassing and lying to federal agents in September. The short trial failed to make clear whether Ms. Zhang was a befuddled tourist or a foreign spy.

“I come to meet the president and his family, just to make friends,” Ms. Zhang said on Monday.

The judge scolded Ms. Zhang for lying to the government and changing her story after she suggested on Monday that Mr. Trump had somehow invited her to his property. Her trespassing offense was analogous to breaking into a government installation such as a military facility, Judge Altman said: “It is a serious offense.”