NEW DELHI — When President Obama landed here for a three-day visit, he brought a long list of issues to discuss, like energy and trade. But when he and Prime Minister Narendra Modi of India sat down to talk, the first 45 minutes were dominated by just one: China.

Mr. Obama and his aides discovered to their surprise that Mr. Modi’s assessment of China’s rise and its impact on the greater strategic situation in East Asia was closely aligned with their own. Just as they did, Mr. Modi seemed increasingly uneasy about China’s efforts to extend its influence around the region and interested in a united approach to counter them.

He agreed to sign a joint statement with Mr. Obama chiding Beijing for provoking conflict with neighbors over control of the South China Sea. He suggested reviving a loose security network involving the United States, India, Japan and Australia. And he expressed interest in playing a greater role in the Asia-Pacific Economic Cooperation forum, where India could help balance China’s influence.

For years, American presidents have tried to enlist India, the world’s largest democracy, in a more robust partnership, partly to offset China’s rising power. India has had a long history of suspicion and rivalry with China, which allied with New Delhi’s archenemy Pakistan during the Cold War. But it has long insisted on being an independent actor in world affairs and resisted aligning itself with the United States against its giant neighbor.

Mr. Modi, by contrast, seems not only willing but eager to redefine India’s relationship with the United States at a time China is on the rise economically, militarily and politically.

“There has been a lot of ambivalence in India about China, just as there has been in the United States,” said K. Shankar Bajpai, a former Indian ambassador to the United States and China. “Now, both sides are clearer about their own interests and better understand that those interests are similar.”

If that proves enduring, it could signal a shift more consequential than any specific deals or statements signed during Mr. Obama’s stay here. In effect, American officials hope the two powers can do much more together than the United States could do alone to restrain China’s ambitions and preserve the postwar order in the region.

The possibility of an Indo-American partnership tilted against it clearly aggravated China this week as it lashed out against Mr. Obama’s visit to New Delhi. A commentary in Xinhua, the official Chinese state news agency, dismissed what it called a “superficial rapprochement.” It recalled that the United States once barred Mr. Modi from traveling there and that the two were fighting just a year ago over the arrest of an Indian diplomat accused of exploiting a housekeeper in New York.

The Xinhua report went on to say that the visit “is more symbolic than pragmatic, given the longstanding division between the two giants, which may be as huge as the distance between them.” It added: “Three days are surely not enough for Obama and Modi to become true friends, given their hard differences on issues like climate change, agricultural disputes and nuclear energy cooperation.”

Global Times, a state-run Chinese newspaper, warned that the United States was setting a trap for India. “This fixed pattern of thinking was created and hyped up by the West, which, with ulterior motives, regards the ‘Chinese dragon’ and the ‘Indian elephant’ as natural rivals,” it said.

American officials said China would have nothing to worry about if it did not bully its neighbors, and noted efforts to cooperate with Beijing, most notably the climate agreement Mr. Obama struck in November, a far more significant deal than he struck on the same subject here.

Image

The Republic Day parade in New Delhi. Patrols by Chinese nuclear submarines in the Bay of Bengal last year shook India’s defense establishment.CreditStephen Crowley/The New York Times

“The way in which the United States and India approach the issue in the Asia Pacific is very similar in the sense that nobody is aiming for confrontation with China or even to contain China,” said Benjamin J. Rhodes, a deputy national security adviser to Mr. Obama. “At the same time, I think what you see is that the United States and India are committed to a rules-based order in this part of the world.”

The discussions on China came amid a broader effort to strengthen ties between the United States and India. On his second day here, Mr. Obama sat for two hours as the chief guest at India’s Republic Day parade showcasing the country’s mainly Russian-made military hardware.

He also hosted a meeting of American and Indian executives to talk about expanding trade. The United States does about $100 billion in trade with India a year, a fraction of the $560 billion it does with China. Mr. Obama’s administration has set a goal of increasing trade with India to $500 billion a year.

Mr. Obama’s conversation with Mr. Modi on China was “really qualitatively different” than past discussions with Indian leaders, according to a senior administration official, who like several others asked not to be identified describing the private talks. “I really was struck that he took a similar view to us,” the official said.

For a joint statement, Mr. Modi agreed to American language on China’s regional disputes. The leaders reaffirmed “the importance of safeguarding maritime security and ensuring freedom of navigation and over flight throughout the region, especially in the South China Sea.” They also called “on all parties to avoid the threat or use of force” in maritime disputes.

Mr. Modi’s suggestion of fresh security cooperation linking the two with Japan and Australia would bring back a short-lived effort involving the four democracies that began in 2007. Known as the Quadrilateral Security Dialogue, it drew protests from China and was abandoned a year later with a change of government in Australia.

Video

President Obama and the first lady attended India’s Republic Day Parade on Monday and watched a grand display of military hardware, marching bands, helicopters and elaborately dressed camels.CreditCreditJim Bourg/Reuters

Mr. Modi’s determination to play a greater role in Asian affairs, a policy known as “Act East,” coincides with Mr. Obama’s own so-called pivot to Asia. The two countries had been moving toward consensus on China for years, but that was particularly solidified by events of the last year, analysts said.

Among the most important were patrols by Chinese nuclear submarines in the Bay of Bengal, which India considers its strategic backyard. The patrols sent a shudder through India’s defense establishment, as building delays and accidents have left its submarine fleet severely depleted. The possible presence of Chinese nuclear missiles so close to India’s coastline undercut its nuclear deterrence.

The second event was a three-day visit in September by President Xi Jinping of China during which Chinese troops confronted Indian troops in the disputed Ladakh region of Kashmir, infuriating Mr. Modi, who had planned to make considerable efforts to get relations with China off to a good start.

“Mr. Modi discovered that the more charming and hospitable you are to the Chinese, the tougher they decide to be with you,” said Lalit Mansingh, a former Indian foreign secretary and ambassador to the United States.

The two essentially squared off in a proxy fight earlier this month in Sri Lanka, which had hosted one of the Chinese submarines last fall. Although India denied directly intervening, it was happy when elections this month turned out a government friendly to China. The election was seen as a setback for Beijing.

Indian leaders had long feared that being too cozy with the United States would poison relations with China, Mr. Mansingh said. But if being nice to China led only to further confrontation, then one of the last obstacles to closer cooperation with the United States dropped away, he said.

“Obama’s visit shows that Mr. Modi has concluded that the U.S. is not just a strategic partner but is India’s principal strategic partner in the world,” Mr. Mansingh said. “It’s a clear upgradation in the relationship, and it signals a new direction of Indian foreign policy.”

A version of this article appears in print on , on Page A4 of the New York edition with the headline: U.S. and India Share Sense of Unease Over China. Order Reprints | Today’s Paper | Subscribe