Roger Stone, an informal Trump campaign adviser, is the author of “The Making of the President 2016,” from which this essay is excerpted.

Donald Trump pulled off the greatest upset in American political history with his win over Hillary Clinton. In 2016, Trump repeated President Harry S. Truman’s miracle of 1948—he won the presidency, coming from behind in an election where the polls, the media, and the pundits had declared him out of the race virtually from the moment he declared his candidacy.

What 1948 demonstrated and 2016 confirmed was that victory goes not necessarily to the favorite, but almost certainly to the candidate who proves the most capable of closing.

Borrowing a chapter from the “Give ’Em Hell, Harry” book, Trump took on a work schedule that would kill younger men. He dazzled at five and six stops a day. He slept four hour a night. Truman used a train; Trump used “Hair Force One” -- his private plane. I have never seen a better closer.

Truman conducted a “whistle-stop” campaign to overcome the lead of Republican challenger Thomas Dewey. Truman was a sitting president, who as vice president took the oath of office after Franklin D. Roosevelt died on April 12, 1945. But Dewey was an enormously popular candidate, a former New York prosecutor who built his reputation fighting organized crime. This was Dewey’s second run for the presidency, having lost to FDR in 1944 (when Roosevelt won his famous fourth term in office).

Like Hillary Clinton, Dewey was stilted in public — detached, and not natural mingling with people. Truman and Trump thrived on the energy of their crowds as they hit each stop. Truman drove the engineers to break all speed laws to maximize time for speeches at each stop. Trump did the same to his pilots as he hopscotched through Michigan, Wisconsin and Pennsylvania in a frenzy of action. Both pulled massive crowds.

Truman’s idea to run a train campaign happened almost by accident. The inspiration came when conservative Republican Sen. Robert A. Taft of Ohio accused him of “blackguarding Congress at whistle-stops across the country.” Truman’s rail campaign, which occurred when Donald Trump and Hillary Clinton were infants, was the precursor to Trump’s series of well-attended rallies 68 years later.

What exactly is a “whistle-stop”? In his 2000 book, “The Last Campaign: How Harry Truman Won the 1948 Election,” historian and economist Zachary Karabell described it as “a town so small and insignificant that it had no regularly scheduled train service and had to signal the train by whistle if any passengers wanted to board.” In his best-selling 1992 biography, author David McCullough observed of Truman, “No president in history had ever gone so far in quest of support from the people, or with less cause for the effort, to judge by informed opinion. Nor would any presidential candidate ever again attempt such a campaign by railroad.”

Traveling 20,000 miles through 30 states and delivering 280 speeches, Truman’s whistle-stop speeches were not noted for visionary themes or lofty rhetoric. Instead, it was a campaign of plain speaking, in which Truman repeatedly attacked the GOP for the high cost of living, portraying the Democratic Party as the party of the people. As Karabell described it, Truman’s speeches communicated “a campaign of us and them, of anger, and bitterness, of the haves and the have-nots.” Karabell stressed that in fighting to lead the nation for four more years, Truman “was willing to sow dissension, stir up fear, and slander his opponents.”

In her self-published 1964 book, “A Choice Not an Echo,” conservative luminary Phyllis Schlafly argued that Dewey lost in 1948 because he was a “me too” candidate who refused to criticize Truman sharply for the New Deal, failing to take on the president directly for his liberal ideology while shying away from arguing strong conservative policy alternatives. Schlafly believed that if Dewey had gone after Truman vigorously while arguing for strong conservative politics, the message would have been well-received by voters in 1948, a time when the nation was emerging from the Depression and World War II. In 2016, Schlafly was one of the first conservative leaders to endorse Trump, authoring her latest book, “The Conservative Case for Trump,” in which she defined what was to become known as the “Trump movement.”

To those whose political awareness developed in the age of television, Truman’s rhetoric sounds extreme, almost rabble-rousing. Karabell noted that Truman realized he was speaking almost exclusively to the small audience present in each whistle-stop town with each speech. “If he went too far during a whistle-stop speech, if he played fast and loose with facts, or if he descended to flinging dirt at his opponents, he knew that at worst he would be ridiculed or criticized by the press corps,” Karabell wrote. “They might write negative articles, and columnists might invoke fair play and morality. But for most of the millions who would vote, the episode wouldn’t exist. Some might read about the speech or peruse editorials against it; some might even hear it on the radio and recoil. But neither print nor radio had the same visceral effect that television would later have.”

This was the oddity about Trump: In the age of television—and the Internet—he got away with a whistle-stop speaking style from another era. When he first announced his candidacy, the mainstream media considered him even less than an underdog. The press ridiculed Trump while pundits constantly discounted his chances, never tiring of proclaiming that this gaffe or that misstep would certainly be the end of his candidacy.

Trump succeeded precisely because the broadcast media cooperated with the print media in excoriating him for a host of remarks Hillary characterized as “deplorable.” Actually, she said Trump’s supporters were a “basket of deplorables.” Hillary works with a script; this attack was scripted and backfired badly.

Hell, I was on the “deplorable list” because I had written “The Clintons’ War on Women,” a book exposing their crimes. Hillary looked snotty and elitist. The comment was a misstep that hurt her badly. She was attacking Trump’s supporters – hard-working Americans. The proof of how little working-class Americans appreciated this condescension was the size of the audiences Trump drew in the campaign’s last weeks.

His crowds were massive. In underestimating the importance of Trump’s drawing ability at rallies, the Democrats made a classic blunder. Very few experts caught the coming Trump tidal wave — or that Trump was copying the playbook of peppery and determined Harry Truman in a super-human sprint across the country. It could be the greatest close in U.S. history.