The deal still must be approved by Major League Baseball on Thursday.
Had the two sides not come to terms by 9 p.m. MST, Scherzer would have gone back into this year's draft pool and the D-backs would have gotten the 65th overall pick as compensation.
Scherzer, who was selected with the 11th overall pick, was the final first-round pick to reach agreement. With Scherzer represented by agent Scott Boras, the D-backs figured the negotiations would go down to the wire. In 2005, the team reached an agreement with shortstop Stephen Drew just moments before a similar deadline. Drew also had Boras as his agent.
Scherzer was the 2005 Big 12 Conference Pitcher of the Year after he led the conference in ERA (1.86) and strikeouts (131) that year. In 2006, his final collegiate season, he was 7-2 with a 1.95 ERA in 13 games (12 starts). The Chesterfield, Mo., native held opposing hitters to a .204 batting average and struck out 72 while walking 23 in 73 2/3 innings.
Negotiations seemed to quickly stall following the draft and Scherzer signed in April to pitch for the independent Forth Worth Cats.
"I've added a two-seam fastball that I can throw in the games now," Scherzer told MLB.com recently. "I had it in college, but I never felt comfortable with it and couldn't throw it for strikes. I have a lot more confidence in it now. Also, the balls are different and have lower seams than in college, which makes the ball easier to move. The Minor League balls have really sharpened up my slider.
"And, just in the last month or so, I changed my changeup grip to more of a straight change, so it comes out with more of a four-seam spin. Those are some of the things I've added. Even though I didn't have a contract, I got better."
Scherzer was projected to go near the top of the draft earlier last year before a couple of minor injuries caused him to slip a bit. The 6-foot-2, 210-pounder slammed a door on the middle finger of his pitching hand and had a case of biceps tendinitis during the season, which cost him about three weeks.
Terms of the deal were not released, but it's believed to be a Major League contract that is worth between $4 million and $4.5 million.
Steve Gilbert is a reporter for MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.