The crowd gave the three-time Cy Young Award winner a standing ovation, and Scherzer doffed his cap. He threw the keepsake ball into the dugout. Hosmer went down on six pitches, retired on a swinging strike.
Scherzer, 37, also had a perfect game through 7⅓ innings before Hosmer doubled; his start also included an immaculate inning.
Scherzer threw eight innings, allowing only one hit and striking out nine on 92 pitches.
Knowing Scherzer needed one more strikeout to reach the mark, fans got to their feet and cheered each time he had two strikes. Some held up cellphones to record the moment.
Scherzer came into the game needing six strikeouts to reach 3,000. He got Trent Grisham in the first. He struck out the side on nine pitches in the second, retiring Fernando Tatis Jr., Hosmer and Tommy Pham, who all went down swinging.
In the third, Scherzer struck out Wil Myers on five pitches.
Scherzer was drafted by Arizona in 2006 out of Missouri. He has pitched for the Diamondbacks, Detroit and Washington, and is 188-97 with a 3.15 ERA in his career.
The Associated Press contributed to this report.