In the Rockies' first, DJ LeMahieu and Carlos Gonzalez delivered one-out hits and scored on Nolan Arenado's double and Gerardo Parra's fielder's choice grounder for a 2-0 lead against starter Rubby De La Rosa.
After Castillo's homer, Matzek walked Chris Hermann and Yasmany Tomas before Brandon Drury and Evan Marzilli delivered RBI singles for a 3-2 D-backs lead.
The D-backs' Kyle Jensen, who belted 47 homers in the last two Triple-A seasons with the Marlins and Dodgers organizations, added a two-run shot off lefty Tyler Anderson in a three-run sixth. It was Anderson's first action since Aug. 29, 2014, before he was shut down with a stress fracture of the left elbow during a standout year at Double-A Tulsa.
Up next for D-backs: Left-hander Robbie Ray, who is battling for the No. 5 spot in the rotation, will get the start for the D-backs on Thursday at 1:10 p.m. MST in a Cactus League rematch with the Rockies at Salt River Fields. Zack Godley, who is also battling for the final rotation spot, is also scheduled to pitch.
Up next for Rockies: Right-hander Jordan Lyles, being counted on heavily after missing much of last season with a right big toe injury, will start against the D-backs at 1:10 p.m. MST on Thursday at Salt River Fields. Also scheduled to appear is righty Eddie Butler, who has had a rough go in two seasons since his first callup.