Donald Trump stuck very close to his script in his primetime convention address in which he accepted the Republican nomination for president. That marked a change for the typically freewheeling candidate, who in past formal speeches has diverged significantly from the prepared text.

Still, Mr. Trump did go off-script several times on Thursday night, and these departures provided some of the most memorable moments of the evening—on gay rights, Democratic presidential nominee Hillary Clinton, and religion, among others. Here's a look at these moments.

Sources: Associated Press (prepared text); Federal News Service (transcript). Note: The comparison of the prepared and delivered speech was edited to align paragraphs and to remove some minor punctuation, capitalization and spelling discrepancies.