When the Oakland A's pulled off the blockbuster trade for pitchers Jeff Samardzija and Jason Hammel on July 4, most people assumed Billy Beane was looking to upgrade his rotation and didn't have faith that Sonny Gray and Scott Kazmir could carry the team into the postseason as frontline starters.

After Sunday, anyone who doubted Gray as the ace of the staff might want to reconsider.

Gray endured the worst month of his young career in June and went 2-2 with a 5.40 ERA while allowing nearly 35 percent of batters to reach base. But since the calendar turned to July, he has been a different pitcher.

He has won all four of his starts and has a 0.95 ERA with 26 strikeouts over 28 1/3 innings this month. It is his longest win streak through his first 30 starts, and it couldn't have come at a better time for the A's, who are trying to fend off a pesky Angels team that will not go away in the AL West race.

Gray also had to overcome some personal demons to get Sunday’s win against the Orioles. He entered the game 0-2 with an 11.42 ERA in two career starts against Baltimore -- by far his worst ERA against any opponent.

Sonny Gray stopped the Orioles cold to give the A's the showdown series. Ed Szczepanski/USA TODAY Sports

What has the 24-year-old first-round pick from Tennessee done this month to turn around his season and become the leader of the A's staff?

Gray's put-away pitch has always been his devastating curveball, a pitch he likes to bury down and away to both lefties and righties. After throwing the pitch nearly 30 percent of the time in April and May, that rate dropped to just 21 percent in June.

Perhaps he lacked confidence in the offering, which batters tagged for a .385/.429/.423 line this past month. He got just 16 outs and allowed 12 baserunners with the 107 curveballs he threw in June.

Gray has revived his signature curve this month and thrown it one out of every three pitches, and batters have barely been able to touch it. His 135 curveballs delivered in July have netted 38 outs, with only eight baserunners allowed.

His curveball was at its best Sunday. The Orioles were hitless in 10 at-bats ending in the pitch. Four of his eight strikeoutS came with the curve, which fooled the O's lineup all afternoon. Location was key, as he threw three-quarters of his 35 curveballs at the knees or lower.

Gray has also benefited from an improved infield defense behind him. In June, batters reached base 27 percent of the time when hitting a grounder against the righty. This month, the Oakland defense has converted his 40 groundballs into 38 outs -- allowing less than 10 percent of batters to reach base.

Perhaps the biggest key to his improved performance in July has been his ability to pitch effectively under pressure. Opponents are 1-for-21 (.048) with runners in scoring position this month, after crushing him for a .379 average in such situations in June.

Gray has been absolutely dominant this month when pitching from the stretch and has barely given opponents a chance to think about scoring against him. Of the 20 outs he has gotten this month with a man on second or third, 17 have been via strikeout or groundout.

Thanks to Gray's ace-like stuff in July, the A's continue to make their case as the best team in baseball, with a major-league-leading 61 wins, though the Angels -- who walked off against Seattle on Sunday afternoon -- lurk just a game back in the loss column.

Nonetheless, it appears it will be very difficult for the Angels to overtake an A's squad that now has the look of a bonafide postseason contender with a dominant starting rotation fronted by a 5-foot-11, 24-year-old righthander who suddenly refuses to lose.