President Trump hit a grand slam Tuesday night, with the best speech of his life and the most remarkable speech in decades by a chief executive to a joint session of Congress.

It wasn’t formally a State of the Union Address, yet it was bigger: maybe the most-watched speech he’ll ever give, setting out his vision for the nation, in a way that obliged Democrats to stand with Republicans in applause time and again.

Trump mainly stuck to his script — yet a key ad-lib was transcendent. The clapping had gone on painfully long to honor Senior Chief Ryan Owens, USN, the first US soldier to die on an operation OK’d by this president: His widow, Carryn, was plainly in agony long before she could finally sit down.

And then the president turned the pain into something else, noting that Chief Owens had surely just set a new record — the longest applause at any of these speeches. You could see Carryn Owens’ relief. Trump had spontaneously shown the depths of his heart and grace.

He opened with grace, and finished with it. Starting off with a forthright honoring of Black History Month and pitch-perfect comments on the recent wave of anti-Semitism, transitioning to this:

“Each American generation passes the torch of truth, liberty and justice — in an unbroken chain all the way down to the present.

“That torch is now in our hands. And we will use it to light up the world. I am here tonight to deliver a message of unity and strength, and it is a message deeply delivered from my heart.”

From there he proceeded to look nine years ahead to the nation’s 250th birthday, offering a protracted vow that his time in office will make that anniversary a joyous one.

Then he tooted his own horn, citing all he’s done in his first weeks on the job, before looking ahead in a broad thematic look at the urgent challenges facing the nation and how he’ll tackle them.

He made news by embracing legal-immigration reform, to a system based on skills — what potential immigrants can offer the nation they hope to join.

And he made his clearest case yet for the need to replace ObamaCare, and what he wants instead. He pointed out, quite rightly, that it’s failing — prices soaring, insurers bailing out, all on top of the broken “you can keep your doctor” promises.

He set out sound principles for what comes next: Give people with pre-existing conditions real options; don’t screw over the folks now enrolled on the exchanges — and above all, find a way to give Americans less-expensive insurance choices.

Then the “meet my guests” section, moving moments culminating in the Owens tribute.

And soon, the profoundly optimistic close.

First he restated a key part of his Inaugural Address: “We are one people, with one destiny. We all bleed the same blood. We all salute the same flag. And we are all made by the same God.”

Then the closing punch: “The time for small thinking is over. The time for trivial fights is behind us. We just need the courage to share the dreams that fill our hearts. The bravery to express the hopes that stir our souls. And the confidence to turn those hopes and dreams to action.

“From now on, America will be empowered by our aspirations, not burdened by our fears — inspired by the future, not bound by the failures of the past — and guided by our vision, not blinded by our doubts.

“I am asking all citizens to embrace this renewal of the American spirit. I am asking all members of Congress to join me in dreaming big and bold and daring things for our country. And I am asking everyone watching tonight to seize this moment and . . .

“Believe in yourselves. Believe in your future. And believe, once more, in America.”

If he can keep this up, the nation is in very good hands indeed.