Japan, the first country to agree in principle with President Reagan's program to cut steel imports, yesterday became the last of the United States' major steel suppliers to approve specific measures to decrease its sales in this country.

Japan agreed in principle last December to support the president's program to limit steel imports to the United States. But agreement on details was harder to come by.

Agreement came after two days of the latest round of negotiations. Talks broke up March 1 when the Japanese walked out after two weeks of fruitless negotiations here, complaining that the United States had increased its demands during the talks.

But Deputy U.S. Trade Representative Robert Lighthizer, who has been conducting the sometimes contentious negotiations with the Japanese since early December, said he finally won agreement on major sticking points, including a five-year duration for the restraints, which are retroactive to Oct. 1.

The agreements are part of the president's plan to help domestic steel makers cope with a flood of imports, which last year averaged a record 26.7 percent of the U.S. market. In January, with most restraints still not in effect, imports surged even higher, to 31 percent of the market.

Under the president's plan, total imports would be held to 18.5 percent of the U.S. market through five years of so-called voluntary restraint agreements with major suppliers. The aim is to give American steel makers protection from foreign competition so they can become internationally competitive.

Under its agreement, Japan would limit its steel sales to 5.8 percent of the U.S. market, a slight decrease from last year's levels. Japan's steel exports in January, however, increased 33 percent in January over December.

Despite strong opposition from Japanese steel makers, the agreement covers the whole range of products it sells in the United States, Lighthizer said. As recently as last Monday, a leading Japanese steel industry spokesman said restraints on a full line of products could cause problems for Japan.

The executive, Taisuke Usami of Kawasaki Steel Corp., asked for "reasonable flexibility" in products to allow Japanese steel makers to meet "the changing demands of long-established customers."

With the Japanese approval ending "the first wave" of restraint agreements with major steel suppliers, Lighthizer said he will now turn his attention to other countries that sell to the United States -- including eastern European nations. He said the United States is close to agreement with Hungary and Czechoslovakia, but far apart in talks with Romania.

"We have to keep an eye out for other countries that are trying to move into the U.S. market," Lighthizer said. "We have to be perpetually vigilant or else we'll have a problem again."