Oregon was the starting point. The Americans and the British both had long established claims, and neither was about to budge. America wanted to extend from sea to shining sea, while the British wanted the fishing rights and ability to use the navigable waterways of the Columbia River. President Polk offered a compromise: extend the existing US-Canada all the way to Puget Sound. The British would get to keep what is now British Columbia, Vancouver Island, and would be allowed free navigation of the Columbia River for 20 years. America would receive full title to what is now Washington and Oregon states.
Britain did not want to give up its claim to the Oregon lands, but was not willing to go to war to defend territory halfway around the world. Polk exploited their desire to avoid another war (knowing that the British were again fighting with the French) and offered them a way to save face. Had the British rejected the offer, Polk assured them, he would just send an army to wipe out the British settlements and forts and claim the whole territory. Once assured that Polk was going to get Oregon, in part or in whole, the British agreed to the compromise.
Mexico was a thornier issue. Texas wanted to be admitted as a state, but Northerners did not want a slave state to be admitted and throw off the balance of power in the Senate. The week of James Polk's inauguration, Texas was officially annexed as a part of the United States. (Iowa was quickly granted statehood to maintain the North-South balance.) Once Texas was annexed, Mexico broke off relations with the US. Mexico and Texas had a disputed border that neither side had been able or willing to enforce.
James Polk stepped in to enforce the border. He sent an army unit across the Nueces River into the disputed zone and set up shop near the Rio Grande, daring Mexico to attack them. Mexico did attack and this attack "on American soldiers on American soil" led to the Mexican-American War. Polk organized several armies and sent one south from Texas, one by sea to Veracruz, and one west across what is now New Mexico and Arizona to California. The Mexican army was quickly defeated, despite some minor victories. The war came to an effective end when the US Army occupied Mexico City.
The Treaty of Guadelupe-Hidalgo finalized the Mexico-Texas border as the Rio Grande and gave the US all of the territory that now includes New Mexico, Arizona, Nevada, Colorado, and Utah. In exchange for taking this land, the US agreed to pay Mexico. To protect their dignity, I suppose.
At the end of his four year term, James Polk had brought America nearly to the shape it is today. He brought more land under the stars and stripe than any President except Thomas Jefferson. He took a nation worried about its future and showed them their Manifest Destiny. If not for his poor health, there is no doubt that James Polk would have been elected to a second term. With that second term, he would be elevated to the ranks of our greatest Presidents. Instead, he is the Greatest President that no one has ever heard of.