Ramirez continued his recent torrid hitting with three hits and three RBIs and Vazquez pitched seven solid innings as the Marlins defeated the Houston Astros 6-3 on Friday night.
"When you go through those moments you just have to fight and fight," Ramirez said of his early season struggles. "I wasn't feeling anything at home plate. I was a different guy."
Ramirez is hitting .448 with three home runs and 11 RBIs in July.
Vazquez (5-8) settled down after a rough first inning and in one stretch, retired 16 of 18 hitters. He allowed two runs and six hits, struck out four and walked none.
Over his last five starts, Vazquez has allowed four earned runs in 30 1/3 innings, struck out 19 and walked three for a 1.19 ERA.
"I'm staying more aggressive, just pounding the strike zone," Vazquez said. "That's what I have to keep doing. Mix up my pitches."
The Marlins won a third consecutive game for the first time since a three-game sweep of San Francisco in May. Florida began its streak with Mike Stanton's walkoff home run in a 7-6 win over Philadelphia on Wednesday and extended it in the first two games of the current four-game series against the Astros.
"I told you guys, when we beat the Phillies in that walkoff, that was going to be our rhythm," Ramirez said. "Everything has been working."
The loss was the Astros' 12th in their last 14 games.
"Javier was able to shut us down and we were really kind of sporadic about getting baserunners," Houston manager Brad Mills said.
Astros rookie Jordan Lyles remained winless after his seventh major league start. Lyles (0-4) pitched six innings and allowed five runs, seven hits, walked three and struck out three.
"I missed a lot of spots today with everything," Lyles said. "I didn't have my stuff. That's not an excuse but I've got to battle a little bit better than I did tonight."
Florida broke a 2-2 tie and took the lead for good on Ramirez's run-scoring single in the third inning. He drove in Gaby Sanchez, who reached on a two-out double.
The Marlins increased the lead to 5-2 in the fifth on Logan Morrison's bases-loaded walk and Mike Stanton's sacrifice fly.
"The thing that's satisfying is seeing these guys do the little things," Florida manager Jack McKeon said. "I was delighted with Morrison walking with the bases loaded. That's how you end up winning ball games."
Stanton hit an RBI single off reliever Fernando Rodriguez in the seventh and increased Florida's lead to 6-2.
Carlos Corporan's one-out RBI single off Florida reliever Burke Badenhop in the ninth made it 6-3. Leo Nunez relieved Badenhop and retired pinch-hitter Jason Michaels and Michael Bourn for his 24th save in 26 opportunities.
Ramirez's two-run home run in the bottom of the first erased a 2-0 deficit. Ramirez drove Lyles' pitch over the wall in right-center field for his eighth home run of the season.
Florida 3B Emilio Bonifacio sat out the game to be his wife, who is expecting a baby. Bourn had his NL-leading 22nd infield hit in the first when he beat Ramirez's throw on a routine grounder to shortstop.