MEXICO CITY — When Donald J. Trump called some Mexican immigrants rapists, threatened to deport millions of them and promised to build a wall to keep others out, Mexican officials counseled caution, saying it was merely bluster from an unlikely candidate who, if elected, would never follow through.

Now, after just five days in office, President Trump is looking a lot like Candidate Trump — and the Mexicans are furious.

With just a few strokes of the pen on Wednesday, the new American president signed an executive order to beef up the nation’s deportation force and start construction on a new wall between the nations. Adding to the perceived insult was the timing of the order: It came on the first day of talks between top Mexican officials and their counterparts in Washington, and just days before a meeting between the two countries’ presidents.

The action was enough to prompt President Enrique Peña Nieto of Mexico to consider scrapping his plans to visit the White House on Tuesday, according to Mexican officials. In a video message delivered over Twitter on Wednesday night, Mr. Peña Nieto did not address whether he would cancel the meeting, saying only that future steps would be taken in consultation with the country’s lawmakers. Instead, he reiterated his commitment to protect the interests of Mexico and the Mexican people, and chided the move in Washington to continue with the wall.