The Associated Press

SAN FRANCISCO — German Marquez almost did more than merely end Colorado’s losing streak. He came close to putting himself in the record book.

Marquez pitched a one-hitter, nicked only by Evan Longoria’s single with one out in the eighth inning, and the Rockies stopped an eight-game skid by beating the San Francisco Giants 4-0 Sunday.

“That was a gem today, it really was,” Rockies manager Bud Black said. “I was really proud of German. From the first pitch on there was a great intent and he built momentum as the game went on. He had life to the fastball and the breaking pitches were outstanding.”

Marquez (2-1) struck out nine and walked none while throwing 105 pitches in the first complete game in the majors this season. It was the first complete game for Marquez in 156 pro starts, including 69 in the big leagues, and the first complete-game one-hitter in Rockies history.

Ubaldo Jimenez pitched the only no-hitter for Colorado in 2010 at Atlanta.

“I looked up in the sixth and they still had no hits,” Marquez said through a translator. “That’s when I knew I had all my pitches working. I knew today especially with the losing streak the team needed me. I was happy to go out there and provide that.”

Marquez had allowed just one runner, hitting Kevin Pillar with a changeup to begin the sixth inning, and was in complete control heading into the eighth before Longoria’s grounder eluded third baseman Nolan Arenado’s dive.

Also Sunday:

Astros 3, Mariners 2: SEATTLE — Gerrit Cole struck out 11 in six innings, Aledmys Diaz homered and Houston completed a three-game sweep of Seattle. Cole gave up two runs on four hits, including a leadoff home run to Mitch Haniger.

Red Sox 4, Orioles 0: BOSTON — David Price pitched seven stellar innings with seven strikeouts, Xander Bogaerts hit a three-run homer and Boston beat Baltimore.

Phillies 3, Marlins 1: MIAMI — Jean Segura’s two-run homer in the 14th inning put Philadelphia on top, and the Phillies beat Miami in the longest game of the young season for either team.

Dodgers 7, Brewers 1: LOS ANGELES — Ross Stripling tossed eight strong innings to rescue an overworked bullpen, Joc Pederson and Alex Verdugo homered, and Los Angeles routed Milwaukee to snap a six-game skid.

White Sox 5, Yankees 2: NEW YORK — Tim Anderson hit his first career grand slam and Carlos Rodon pitched Chicago over scuffling New York.

Royals 9, Indians 8: KANSAS CITY, Mo. — Pinch runner Terrance Gore stole a base and then scored on Hunter Dozier’s single in the ninth inning, lifting Kansas City over Cleveland to complete a three-game sweep.

Braves 7, Mets 3: ATLANTA — Julio Teheran outpitched Jacob deGrom, Josh Donaldson and Nick Markakis homered, and Atlanta beat New York.

Cardinals 9, Reds 5: MONTERREY, Mexico — Marcell Ozuna hit two home runs and Matt Carpenter connected for a tiebreaking drive in the seventh inning that sent St. Louis over Cincinnati for a split of their two-game series in Mexico.

Diamondbacks 8, Padres 4: PHOENIX — Zack Greinke pitched seven strong innings and David Peralta connected for a three-run homer as Arizona beat San Diego to stop a four-game losing streak.

Rangers 8, Athletics 7: ARLINGTON, Texas — Danny Santana had a two-run, pinch-hit triple and scored the go-ahead run on Delino ­DeShields’ bunt single during a four-run eighth inning, lifting Texas over Oakland.

Rays 8, Blue Jays 4: TORONTO — Pinch hitter Guillermo Heredia homered to cap a five-run burst in the eighth inning and Tampa Bay beat Toronto for its fifth straight series victory to start the season.

Pirates 4, Nationals 3: WASHINGTON — Rookie Jason Martin hit a tiebreaking double in the ninth inning to help Pittsburgh to a win.

Twins 6, Tigers 4: MINNEAPOLIS — Jose Berrios pitched into the seventh inning for his first win since opening day as Minnesota beat Detroit to complete a two-game sweep.