Mr Obama said he and Mr Medvedev broadly agreed on Iran
The Russian president has signalled that Moscow might be prepared to soften its opposition to further sanctions against Iran over its nuclear plans.
Dmitry Medvedev, speaking after talks with US President Obama, said that in some cases sanctions were "inevitable".
But the Chinese foreign ministry has said that increasing pressure on Iran would not be effective.
"Sanctions and exerting pressure are not the way to solve problems," said spokeswoman Jiang Yu.
She said sanctions "are not conducive for the current diplomatic efforts on the Iran nuclear issue".
Iran's president did not refer directly to the nuclear stand-off in his address to the UN General Assembly in New York.
However, Mahmoud Ahmadinejad spoke of countries which undermined the development of other nations under the pretext of preventing arms proliferation.
He used his speech to accuse Israel of "inhuman policies in Palestine" and condemn US-led military action in Iraq and Afghanistan.
Iran was ready, he said, to shake all hands "that are honestly extended to us".
Several countries' delegations walked out of the assembly during Mr Ahmadinejad's speech, including France and the United States.
The BBC's Jeremy Bowen says the speech appeared to be designed to send a variety of messages.
For his supporters, there were more harsh words about Israel.
But his remarks about shaking hands sounded like a deliberate echo of the language used by President Obama about the prospect of engagement with Iran, our correspondent says.
President Obama wants a united position among the group of six global powers due to hold talks next week with Tehran on its nuclear programme.
Analysts say that if those talks yield nothing he wants to pursue tougher sanctions against Tehran.
Russia has so far opposed any fresh sanctions.
But last week President Obama dropped plans for an anti-missile defence shield close to Russian borders.
There was speculation that in exchange, Moscow would make a move on sanctions against Iran.
On Wednesday, a Russian official said Moscow could support fresh sanctions if there was enough evidence from UN inspectors.
Mr Medvedev said sanctions were rarely productive but he opened the door to the possibility if Iran pressed ahead with its suspected nuclear weapons programme.
"In some cases sanctions are inevitable," he said after he and Mr Obama met on the sidelines of the UN General Assembly.
"We need to help Iran to (make) the right decisions," he said.
Mr Obama said he and Mr Medvedev shared the goal of allowing Iran to pursue peaceful nuclear energy, but not nuclear weapons.
"Unfortunately, Iran has been violating too many of its international commitments," Mr Obama said.
"What we have discussed is how we can move in a positive direction that can resolve a potential crisis."
Speaking earlier, an unnamed Russian official did not rule out UN sanctions against Iran "if there are objective grounds", Russia's state-run RIA-Novosti reported.
For Russia, "the criteria are not individual evaluations, not guesswork, but the report and recommendations of the (UN) International Atomic Energy Agency", the official reportedly said.
Iran's nuclear agenda coupled with new missile technology alarms Israel
Those comments were quickly welcomed by the White House.
"Their willingness to play a constructive role is extremely important," said Robert Gibbs, quoted by AFP news agency.
British Foreign Minister David Miliband said on Wednesday that the six powers had agreed Iran must give a "serious response" in the forthcoming talks.
US Secretary of State Hillary Clinton said it was time "for Iran to engage with the international community".
Tehran says its nuclear programme is for civilian uses only, but Western powers suspect it is trying to develop a nuclear weapon.
Six world powers are to hold talks with Iranian officials on 1 October that are expected to cover global nuclear disarmament.
Iran's nuclear plans have also come under fire at the UN General Assembly.
French President Nicolas Sarkozy said Iranian leaders were "making a tragic mistake" if they thought the international community would not respond.
British Prime Minister Gordon Brown warned Iran - and North Korea - that the world would be even tougher on proliferation.