Hardy's two-run homer in the third inning but the O's in front for good at 3-1.
The shortstop added a run-scoring single in the sixth for 6-1 lead and capped his big night with another two-run blast in the eighth as Baltimore claimed the first of a three-game series.
Matt Wieters went 3-for-3 with a two-run double and Chris Davis added a solo shot for the O's, who forged a tie with the New York Yankees atop the American League East with their sixth win in nine games.
Jason Hammel started on the mound but came out after 3 2/3 innings with an injury to his right knee. The hurler had surgery on the same knee in mid-July.
The victory went to Steve Johnson (3-0), who tossed 1 1/3 scoreless frames.
Matt Moore (10-10) went four innings for the Rays, surrendering four runs (three earned) on four hits.
Ryan Roberts and Elliot Johnson homered for Tampa Bay, which came into the contest one game out of an AL wild card spot.
2014: NFL Cheerleaders [PHOTOS]
Michael Sam cut from the Dallas Cowboys