HONG KONG—A U.S. judge ruled that ZTE Corp.’s probation for violations of U.S. sanctions on Iran could end, freeing the Chinese technology company from some oversight following years of government supervision.

The decision by the federal judge in Texas effectively ends ZTE’s five-year term of supervision under a Dallas lawyer assigned to police the company’s adherence to the terms of its 2017 settlement agreement resolving the sanctions charges.

ZTE is the world’s fourth-largest maker of telecommunications equipment and a major builder of 5G networks in China. The company is effectively blocked from selling its gear in the U.S., where officials regard it as a security threat, though it was a significant player in the U.S. smartphone market before its guilty plea.

The ruling removes one constraint as the company looks to regain ground following a number of bruising punishments from the U.S., including huge fines and an export blacklisting by President Donald Trump’s administration. It remains subject to a compliance monitor based in Washington for an additional six years.

ZTE shares in Shenzhen rose 10%, hitting their trading limit, while shares in Hong Kong surged 27%.

In his ruling, U.S. District Judge Ed Kinkeade said on Tuesday that ZTE’s probation could end, despite what he said was the company’s connection to a separate visa-fraud case. That case was brought by the Justice Department against a former ZTE researcher last year and doesn’t name ZTE as a defendant. In making his decision, Judge Kinkeade noted mitigating factors including that ZTE had made strides in improving its compliance practices.

The Wall Street Journal reported in October that the court-appointed monitor, James Stanton, had sought to extend his own term beyond the Tuesday expiration of ZTE’s probation and threatened ZTE if the company refused to accede, citing people familiar with the matter.

Mr. Stanton didn’t immediately respond to a request for comment. He previously called the Journal report inaccurate without commenting further.

After the Texas ruling, Shenzhen-based ZTE said that it was committed to building a comprehensive compliance system. “The company has full confidence in the effective operation and continuous improvement of the compliance management system,” the company said.

The decision closes a chapter in a legal saga stemming from ZTE’s 2017 settlement agreement, resolving allegations that it violated U.S. sanctions on Iran. In the settlement ,ZTE agreed to pay $900 million and admitted to orchestrating a six-year conspiracy to acquire U.S. technology, send it to Iran and mask its involvement through a network of front companies.

In 2018, the Trump administration accused ZTE of violating the terms of that deal and as punishment placed the company on an export blacklist, to devastating effect. The Commerce Department ordered ZTE to pay an additional $1 billion and replace its senior leadership to get off the blacklist.

It also forced ZTE to fund another team of lawyers to separately monitor the company for 10 years. That compliance team, led by Washington lawyer Roscoe Howard, has six years left in its term.

In the separate visa-fraud case, the Justice Department last year accused a ZTE researcher of involvement in a conspiracy to bring Chinese nationals to the U.S. to work at ZTE while possessing visas that didn’t allow them to do so. The case is in progress in the Northern District of Georgia.

In his ruling on Tuesday, Judge Kinkeade said that ZTE played a role in the visa-fraud scheme but declined to penalize it further, citing its progress in improving its compliance systems, the work of the Dallas monitor team and a question over whether he was able to impose additional punishments given the extent of penalties applied to date.

Write to Dan Strumpf at daniel.strumpf@wsj.com