Gasoline rose as oil traded near the highest price in nine months after euro-area finance ministers agreed on a second bailout for Greece.

Futures gained as crude advanced as much as 2.1 percent. European finance ministers approved 130 billion euros ($173 billion) in aid for Greece by tapping into European Central Bank profits and coaxing investors into providing more debt relief to shield the region from a default.

“It’s very much the Greek situation and the stability it brings to the markets,” John Kilduff, a partner at Again Capital LLC, a New York-based hedge fund that focuses on energy, said by phone. “Now we can focus on the continuing improving data set that we’ve been getting in the U.S.”

March-delivery gasoline rose 3.56 cents, or 1.2 percent, to $3.0512 a gallon at 9:24 a.m. on the New York Mercantile Exchange after touching $3.0578. Prices gained 1.4 percent last week and are up 14 percent so far this year.