As the United States and allied nations grapple with questions about their unity in dealing with Russia’s wartime aggression and China’s growing assertiveness, Secretary of State Antony J. Blinken stressed on Tuesday at the close of a meeting of top diplomats in Japan that the countries spoke with one voice on the two pivotal issues.

Mr. Blinken said at a news conference after three days of Group of 7 meetings that the coalition “from the get-go has led the world in galvanizing and sustaining support for Ukraine,” and that its members “stand with Ukraine” as the besieged country prepares for an important counteroffensive against Russia.

On China, Mr. Blinken said the allies “are resolved and united in the need for candid discussions with Beijing about its unfair trade practices” and “its actions that undermine the international rules that all nations benefit from,” as well as pushing back on China’s partnership with Russia.

The top diplomats from the Group of 7 nations — the United States, Japan, Canada, Britain, France, Germany and Italy, as well as the European Union — arrived in the Japanese resort town of Karuizawa on Sunday at a critical period of diplomacy for the allied governments.

In recent weeks, they have faced growing questions about how united they are on their approaches to Beijing on trade and security, and whether they can stay firm on their resolutions to help Ukraine win its grinding war against the Russian invaders.

The question of whether the allies would fracture over strategy, particularly on issues around China and its military actions aimed at the de facto independent island of Taiwan, has simmered because of conciliatory remarks that President Emmanuel Macron of France made during his visit earlier this month to Beijing.

The clutch of diplomats in Japan, which included Catherine Colonna of France, appeared to put aside any differences in broad outlook or tactics to focus on common approaches to policy.

Mr. Blinken’s remarks echoed the first line of the communiqué issued on Tuesday by the Group of 7 foreign ministers, which said the countries “underline our strong sense of unity as the world navigates grave threats to the international system, including Russia’s continued war of aggression against Ukraine.” The emphasis on that message now was notable; the communiqué released at the foreign ministers’ meeting last year, in Germany, did not stress “unity” at the very top.

“We remain committed to intensifying sanctions against Russia, coordinating and fully enforcing them,” the statement said, “and countering Russia’s and third parties’ attempts to evade and undermine our sanctions measures. We reiterate our call on third parties to cease assistance to Russia’s war, or face severe costs.”

That message appeared directed at Iran, China and several other countries. Iran has given weapons aid and training to Russia, while China has provided Moscow with important diplomatic support. Chinese officials have so far refrained from sending artillery shells or other arms to Russia, though U.S. officials warn that Beijing has kept that option open. A recent leaked U.S. government document labeled “top secret” said that leaders of Egypt, a U.S. ally and beneficiary of significant annual American military aid, had discussed producing up to 40,000 rockets and secretly shipping them to Russia.

The communiqué also emphasized support for efforts by President Volodymyr Zelensky of Ukraine to “promote a comprehensive, just and lasting peace” consistent with principles of the United Nations Charter — an implicit rebuke of China’s declarations of recent months that it was leading a peace initiative on Russia’s war in Ukraine.

American officials say China is trying to create a smoke screen to allow President Vladimir V. Putin of Russia to secure his territorial gains in Ukraine and regroup his forces. Some European officials have been more circumspect about China’s efforts, and several countries, notably Brazil, have endorsed China’s statements.

In leading this year’s meetings of the Group of 7 nations, Japanese officials have sought to further highlight difficult issues in Asia — particularly China’s assertive actions in disputed areas of the South and East China Seas; its aggression toward Taiwan; and its attempts at economic coercion. The first working session of the meeting, a dinner on Sunday, was on China and North Korea, whose constant missile tests have alarmed Japan.

The first line of the communiqué in the section on China had language that was not in the foreign ministers’ statement last year: “We recognize the importance of engaging candidly with and expressing our concerns directly to China.”

Yoshimasa Hayashi, the foreign minister of Japan, who presided over the three-day meeting, said at his own news conference on Tuesday that “as the G7, we shared concerns about China’s expanding nuclear arsenal and affirmed the importance of transparency.”

“We strongly urged China to swiftly join talks with the U.S. aimed at reducing strategic risks,” he added.

In Beijing, a Foreign Ministry spokesman, Wang Wenbin, responded at a daily news conference to the comments on China’s nuclear buildup, saying that it “always follows a nuclear strategy that is defensive in nature.”

And he lashed out at the conclave in Japan. “The G7 foreign ministers’ meeting has grossly interfered in China’s internal affairs and maliciously smeared and discredited China,” he said. “The communiqué is full of arrogance and prejudice with the intention of harming China. We deplore and reject this.”

Earlier this month, Mr. Macron traveled to Beijing with a delegation of about 50 business executives and expressed confidence in Xi Jinping, China’s leader, taking a different approach than the confrontational stand of the Biden administration.

On the return flight to Paris, Mr. Macron told reporters that Europe needed to establish a foreign policy independent from that of the United States, and that France was not an American “vassal” and would not be dragged into a conflict with China over Taiwan, whose government American leaders support with weapons aid.

Mr. Macron later said in Amsterdam that France had remained consistent in supporting the maintenance of the “status quo” over Taiwan, in which Taiwanese leaders maintain the island’s democratic self-governance but do not provoke China by declaring independence.

The French leader’s earlier remarks set off a firestorm among officials and policy analysts in Washington, who saw them as insensitive or offensive. They asserted that Mr. Macron should be showing strong support for Washington’s efforts to constrain China, and on the issue of Taiwan in particular. At the very least, they said, Mr. Macron should do that as a show of gratitude for the billions of dollars of military and economic aid that the U.S. government has given Ukraine in its resistance against Russia, which France and other European nations see as the most important foreign policy issue in at least a generation.

President Biden has said repeatedly that Russia is a medium-term problem, while China poses the greatest long-term challenge to an American-led global coalition and institutions.

Some European analysts praised Mr. Macron’s Gaullist philosophy of a Europe distanced from American policies, while others criticized him.

Annalena Baerbock, the foreign minister of Germany, traveled to China soon after Mr. Macron made his trip and took a more confrontational approach with officials there. She represented Germany at the Group of 7 meeting in Japan, and she often eagerly agrees with Mr. Blinken in public on major issues.

Officials in Berlin are split on how to craft policy on China, and Olaf Scholz, Germany’s chancellor, took an approach similar to Mr. Macron’s when he traveled to Beijing in November to meet with Mr. Xi, bringing a large business delegation with him.

A senior State Department official said on Monday night, after the first full day of meetings, that the European officials who had visited Beijing recently had all gotten commitments in face-to-face meetings that China would not send weapons to Russia for use in Ukraine.

The European visitors to Beijing also stressed the importance of maintaining peace and stability across the Taiwan Strait, the U.S. official said.

In addition to addressing Russia and China, the Group of 7 communiqué had pointed lines on a new crisis: the violence in Sudan between two military groups. “We urge the parties to end hostilities immediately without preconditions,” it said.

For Mr. Blinken, the spiraling violence in Sudan cast a shadow over his trip, which began last week in Dublin, where he accompanied Mr. Biden on a visit, and included a two-night stop in Hanoi, Vietnam, before ending in Karuizawa.

Mr. Blinken said he spoke Tuesday morning with the two Sudanese generals leading the opposing forces in the conflict and urged that they enter into an immediate cease-fire. And he said a U.S. diplomatic convoy in Khartoum had come under attack on Monday, perhaps by fighters associated with the Rapid Support Forces, a paramilitary group.

“All of our people are safe and unharmed,” he said, “but this action was reckless, it was irresponsible and of course unsafe — a diplomatic convoy, with diplomatic plates, a U.S. flag, being fired upon.”

Daisuke Wakabayashi contributed reporting from Seoul.