Ryan Zimmerman had tied the contest before Ramos took over for a 5-4 success.
The Colorado Rockies were beaten for a ninth game in a row as they went down 9-5 to the Los Angeles Dodgers.
Justin Turner clubbed a two-run homer in a decisive four-run eighth for the Dodgers, who were walked 10 times by some errant pitching.
The Boston Red Sox responded to losing seven of eight by beating the Toronto Blue Jays 6-3, Mike Napoli hitting a three-run homer, while 11 strikeouts from Danny Salazar got the Cleveland Indians an 8-2 win over the Minnesota Twins.
AJ Pollock hit the winning run for the Arizona Diamondbacks as they beat the San Diego Padres 2-1, while back-to-back homers from Martin Maldonado and Elian Herrera helped the Milwaukee Brewers beat the Chicago Cubs 3-2.
Matt Duffy’s walk-off single was the difference as the San Francisco Giants beat the Miami Marlins 3-2 and Gordon Beckham’s RBI single got the Chicago White Sox a 4-3 success over the Cincinnati Reds.
Elsewhere, the New York Mets beat the Philadelphia Phillies 7-4, the Los Angeles Angels beat the Houston Astros 3-1 and the Pittsburgh Pirates saw off the St Louis Cardinals 4-3.
The New York Yankees beat the Baltimore Orioles 6-2 as Michael Pineda struck out a career-best 16 over seven, the Texas Rangers saw off the Tampa Bay Rays 2-1, the Seattle Mariners were 4-3 winners against the Oakland Athletics and the Kansas City Royals were 2-1 victors against the Detroit Tigers.