The funding "will work out in the formula somehow", Trump said, adding later that "it will come out in the wash, and that is okay". But "if you are going to say that Mexico is not going to pay for the wall, then I do not want to meet with you guys anymore because I cannot live with that".
He described the wall as "the least important thing we are talking about, but politically this might be the most important".
The heated exchange came during back-to-back days of calls that Trump held with foreign leaders a week after taking office. The Post has obtained transcripts of Trump's talks with Pena Nieto and Australian Prime Minister Malcolm Turnbull.
Produced by White House staff, the documents provide an unfiltered glimpse of Trump's approach to the diplomatic aspect of his job, subjecting even a close neighbour and long-standing ally to streams of threats and invective as if aimed at US adversaries.
The January 28 call with Turnbull became particularly acrimonious. "I have had it," Trump erupted after the two argued about an agreement on refugees. "I have been making these calls all day, and this is the most unpleasant call all day."
Before ending the call, Trump noted that at least one of his conversations that day had gone far more smoothly. "Putin was a pleasant call," Trump said, referring to Russian President Vladimir Putin. "This is ridiculous."
The White House declined to comment. An official familiar with both conversations, who refused to speak on the record because the President's calls have not been declassified, said, "The President is a tough negotiator who is always looking to make the best possible deals for the American people. The United States has many vital interests at stake with Mexico, including stopping the flow of illegal immigration, ending drug cartels' reach into our communities, increasing border security, renegotiating Nafta and reducing a massive trade deficit. In every conversation the President has with foreign leaders, he is direct and forceful in his determination to put America and Americans first."
The official noted that Trump has since met the Australian and Mexican leaders in person and had productive conversations with them.
The transcripts were based on records kept by White House notetakers who monitored Trump's calls. Known as a "memorandum of conversation", such documents are commonly circulated to White House staff and senior policymakers.
Both documents obtained by the Post contain notes indicating they were reviewed and classified by retired Lieutenant General Keith Kellogg jnr, who serves as chief of staff on the National Security Council.
Portions of Trump's strained conversations with Turnbull and Pena Nieto have already been reported, but the transcripts trace the entire course of those calls from greeting to confrontation to - in the case of Turnbull - abrupt conclusion.
Both calls centred on immigration-related issues with high political stakes for Trump, who built his campaign around vows to erect barriers - physical and legal - to entry to the United States.
But there was little discussion of the substance of those plans or their implications for US relations with Australia and Mexico. Instead, Trump's overriding concern seemed to centre on how any approach would reflect on him.
"This is going to kill me," he said to Turnbull. "I am the world's greatest person that does not want to let people into the country. And now I am agreeing to take 2000 people."
The agreement reached by the Obama administration actually called for the United States to admit 1250 refugees, subject to security screening. A White House readout of the Trump call, issued at the time, said only that the two leaders had "emphasised the enduring strength and closeness of the US-Australia relationship".
Trump spent much of his call with Pena Nieto seeking to enlist the Mexican president in a deal to stop talking about how the wall would be paid for. Two days earlier, Trump had signed an executive order mandating construction of the wall, but funding for it remains unclear.
"On the wall, you and I both have a political problem," Trump said. "My people stand up and say, 'Mexico will pay for the wall', and your people probably say something in a similar but slightly different language."
Trump seemed to acknowledge that his threats to make Mexico pay had left him cornered politically. "I have to have Mexico pay for the wall - I have to," he said. "I have been talking about it for a two-year period."
To solve that problem, Trump pressured Pena Nieto to suppress the issue. When pressed on who would pay for the wall, "We should both say, 'We will work it out'. It will work out in the formula somehow," Trump said. "As opposed to you saying, 'We will not pay', and me saying, 'We will not pay'."
Pena Nieto resisted, saying that Trump's repeated threats had placed "a very big mark on our back, Mr President". He warned that "my position has been and will continue to be very firm, saying that Mexico cannot pay for the wall".
Trump objected: "But you cannot say that to the press. The press is going to go with that, and I cannot live with that."
Searching for an exit, Pena Nieto reiterated that the border plan "is an issue related to the dignity of Mexico and goes to the national pride of my country" but agreed to "stop talking about the wall".
The exchange suggests that even at the outset of his presidency, Trump regarded the prospect of extracting money from Mexico as problematic but sought to avoid acknowledging that reality publicly.
Trump reiterated that vow as recently as last month, when he said during a summit of foreign leaders in Germany that he "absolutely" remained committed to forcing Mexico to pay for the wall. Weeks later, however, the House approved a spending bill setting aside $1.6 billion for a structure that is projected to cost as much as $21b.
Trump told Pena Nieto that he knew "how to build very inexpensively and it will be a better wall and it will look nice". He has suggested the money could come from border taxes and even threatened to block remittance payments that flow from workers in the United States to relatives in Mexico, but has yet to provide complete plans or funding details.
Trump also lashed out at Pena Nieto over the US trade deficit with Mexico and the flow of illegal drugs into the United States.
"We have a massive drug problem where kids are becoming addicted to drugs because the drugs are being sold for less money than candy," Trump said. "I won New Hampshire because New Hampshire is a drug-infested den."
Trump won the Republican primary in New Hampshire, but Hillary Clinton carried the state in the general election.
He described Mexican drug cartel leaders as "pretty tough hombres" and promised US military support, saying that "maybe your military is afraid of them, but our military is not".
Pena Nieto said drug trafficking in Mexico is "largely supported by the illegal amounts of money and weapons coming from the United States".
Trump also threatened to impose tariffs of up to 35 per cent on imports from Mexico, saying that as president he had been given "tremendous taxation powers for trade", even though tariffs are mainly the province of Congress.
Despite the friction, Trump at other moments sought to sweet-talk Pena Nieto, telling him that "you and I will always be friends", and that if they could resolve their disputes over the border and trade, "We will almost become the fathers of our country - almost, not quite, okay?"
Though Australia is one of the United States' closest allies, Trump's call with Turnbull was even more contentious. The Prime Minister opened by noting that he and Trump have similar backgrounds as businessmen turned politicians. Trump also inquired about a mutual acquaintance, golfer Greg Norman.
But the conversation devolved into a blistering exchange over a US agreement to accept refugees from Australian detention centres on Papua New Guinea's Manus Island and the island nation of Nauru. The Obama administration had agreed to accept some of those being detained on humanitarian grounds after intervention by the United Nations.
At one point, Trump expressed admiration for Australia's refusal to allow refugees arriving on boats to reach its shores, saying it "is a good idea. We should do that too." In a remark apparently meant as a compliment, Trump told Turnbull, "You are worse than I am".
But the conversation rapidly deteriorated.
"I hate taking these people," Trump said. "I guarantee you they are bad. That is why they are in prison right now. They are not going to be wonderful people who go on to work for the local milk people" - an apparent reference to US dairy farms.
Turnbull tried to salvage the deal, noting that the detainees were economic refugees who had not been accused of crimes. He explained that they were being denied entry into Australia because of a policy aimed at discouraging human smuggling.
"There is nothing more important in business or politics than a deal is a deal," Turnbull said. "You can certainly say that it was not a deal that you would have done, but you are going to stick with it."
Trump only became angrier, saying the refugees could "become the Boston bomber in five years".
"I think it is a horrible deal, a disgusting deal that I would have never made," Trump said. "As far as I am concerned, that is enough, Malcolm. I have had it."
Turnbull tried to turn to Syria and other subjects. But Trump refused. The call, which began at 5:05pm, ended 24 minutes later with Turnbull thanking the still-fuming Trump for his commitment.
"You can count on me," Turnbull said. "I will be there again and again."
"I hope so," Trump said before saying thank you and hanging up.
- Julie Tate contributed to this report