The catcher, acquired from Seattle in the Mark Trumbo trade this week, hit a two-run homer with two outs in the seventh inning to lift Arizona over Bartolo Colon and the New York Mets 2-1 on Saturday night.
Castillo, playing for his third team this year, struck out four times in his Arizona debut Friday night but lined Colon's first pitch just over the left-field wall.
"Really, really nice," he said, "especially to get a win. I wasn't playing very much for the other team that I was on. I'm going to get time to play here."
Colon (8-4), trying to become the NL's first nine-game winner, had blanked Arizona on three hits through six innings.
"I made a mistake," he said through a translator. "Bad pitch, bad location. If you make those mistakes in the big leagues you are going to pay for it. The pitch was running to his wheelhouse and he was able to hit it out of the park."
Randall Delgado (3-2) pitched a scoreless seventh to get the win. Brad Ziegler escaped a ninth-inning jam for his sixth save when pinch-hitter John Mayberry Jr. bounced into a game-ending double play with two on.
It was the fourth double play turned by the Diamondbacks.
The 42-year-old Colon allowed two runs and five hits in seven innings, striking out seven and walking one. He fell to 2/3 in his last five starts.
Arizona's Chip Hale was ejected for the first time as a big league manager, by plate umpire Mark Ripperberger for comments Hale yelled from the dugout after Paul Goldschmidt was called out on strikes to end the sixth.
"Once you show your displeasure they'll let you say a few words, but I started motioning and he'd had enough," Hale said. "I just went out and told him, `Hey, when Goldy argues I know it's not the right call because he really knows the strike zone."
Goldschmidt, who had taken off his helmet and tossed his bat for what he thought was a walk, confronted Ripperberger briefly. Hale said it was only the second time he'd seen Goldschmidt argue like that.
For the second night in a row, the Mets took the early lead with a solo shot, Lagares' second homer of the season. It was only the third home run off Anderson this season and first since April 27.
In the sixth inning, New York had a chance to pad its lead.
"It has been happening a lot," manager Terry Collins said of the Mets' inability to get timely hits. "You've just got to work through it. You can't let it get to you. You can't get too frustrated. You've just got to continue to press forward."
After the game, the Diamondbacks optioned right-hander Dominic Leone to Double-A Mobile to make room for right-hander David Hernandez, who is coming off Tommy John surgery and will be activated on Sunday.
In the fifth inning, the bat slipped out of Campbell's hands and hit Ripperberger in the side of the head. Castillo grabbed Ripperberger to steady him and, after a visit from the Diamondbacks' trainer and a meeting with the other umpires, Ripperberger stayed in the game.
Mets: Collins said shortstop Wilmer Flores was out of the lineup due to general body stiffness.
Diamondbacks: 3B Jake Lamb, out since April 19 with a left foot stress reaction, was activated from the DL. C Jordan Pacheco was designated for assignment. Lamb entered the game as a defensive replacement in the eighth and turned the game-ending double play.
Mets: RHP Jacob deGrom (6-4, 2.41 ERA) pitches the finale of a seven-game road trip Sunday. The NL Rookie of the Year is 3-0 with a 0.92 ERA in his last three starts, with 34 strikeouts and one walk. He has not allowed an extra-base hit in the last 33 1/3 innings.
Diamondbacks: RHP Josh Collmenter (3-5, 5.03) goes for Arizona. He has held opponents to three runs or fewer in his past three starts.
Top six adds for fantasy baseball playoff matchups
If you're in your fantasy finals matchup, or needing just a little push in roto leagues, Tristan offers six players with something to prove this week.
Fantasy Baseball Forecaster for Week 24: Sept. 20 to 26
Set your lineups for the week ahead in fantasy baseball with our forecaster preview, which features pitcher rankings, two-start pitchers, hitter ratings, schedule observations and more.
Fantasy baseball forecaster: Team hitting ratings
Stay ahead of the game and optimize your fantasy baseball hitters with our forecaster, which provides a rolling 10-day outlook of every team's hitting matchups as well as the potential for stolen bases.
Fantasy baseball forecaster: Pitcher projections for the next 10 days
Keep up to date on who is pitching -- and how well they're expected to do -- with our forecaster, which provides a rolling 10-day outlook of every team's probable starting pitchers with game score projections.
The storylines to watch from the final weeks of MLB's regular season
Eduardo Perez details the storylines that are intriguing him the most as baseball's regular season enters its final two weeks.
Two weeks to go! What we're most excited about in the final 14 days of the MLB season
What should fans be watching as September turns into October? We asked our experts to break down baseball's playoff races and storylines.