US and China are in middle of a costly trade dispute that has pressured financial markets. (File)

Four decades of dealings between China and the United States show that positive outcomes were always possible, China's foreign ministry said on Wednesday, after their presidents agreed to rekindle trade talks at a G20 meeting this month.

US President Donald Trump said on Tuesday he would meet Chinese President Xi Jinping at the G20 summit in Osaka, Japan. China, which previously declined to say whether the two leaders would get together, confirmed the meeting.

The world's two largest economies are in the middle of a costly trade dispute that has pressured financial markets and damaged the global economy.

Talks to reach a broad deal broke down last month after US officials accused China of backing away from agreed commitments. Interaction since then has been limited, and Trump has threatened to slap more tariffs on Chinese products in an escalation that businesses in both countries want to avoid.

Speaking at a daily news briefing, Foreign Ministry spokesman Lu Kang said it was important to find a solution that is acceptable to both sides.

"I'm not getting ahead of myself, but communication over four decades shows it is possible to achieve positive outcomes," he said.

Lu said he could not give an exact agenda for the meeting.

"The two leaders will talk about whatever they want," he said. "A deal is not only in the interests of the two peoples but meets the aspirations of the whole world."

In another potential sign of a pre-G20 thaw, state television's movie channel, which has in recent weeks broadcast old patriotic films about China's heroics against the United States in the 1950-53 Korean War, on Wednesday showed a movie that put the United States in a far more positive light.

The channel showed 1999's "Lover's Grief over the Yellow River", about a US pilot in World War Two who is rescued by Communist guerrilla forces in China and falls in love with one of the young women fighters.