Freddie Mac, the government-controlled mortgage financier, reported a $3.02 billion second-quarter profit Tuesday on a stronger mortgage portfolio, in another sign of an improving housing market.

It was McLean, Va.-based Freddie's first profit since the first quarter of 2011. Freddie credited its higher-quality book of mortgages issued after 2009, which made up 57 percent of its business as of June 30. Mortgages from 2005 to 2008, which have accounted for the majority of its losses, comprised of only 28 percent of Freddie's portfolio.

The weighted average credit score of the company's mortgage holders was 762 in the second quarter, up from 759 last year and an average of 723 between 2005 and 2008. The company's single-family serious delinquency rate fell to 3.45 percent on June 30 from 3.51 percent on March 31. The rate is below the average U.S. serious delinquency rate of 7.44 percent on March 31, as reported by the Mortgage Bankers Association.

As part of its agreement with the U.S. Treasury, Freddie and its sister company, Fannie Mae, pay a 10 percent dividend on preferred stock each quarter. In the second quarter, Freddie's profit was enough to cover a $1.8 billion payment. Freddie Mac had a net income of 37 cents per share for common shareholders, up from a loss of $1.16 per share in the year-ago quarter.

It was the fifth time the company hasn't requested additional funding since a 2008 government takeover. Fannie and Freddie have cost taxpayers around $180 billion to date.

Although the results were positive, Freddie's future remains uncertain, with some politicians advocating for the company to be dissolved. Principal writedowns have also been a source of controversy, after Edward DeMarco, the chief regulator of Fannie and Freddie, rejected the writedowns as too financially risky.

Shares of Freddie, which are traded off-market, rose 20.42 percent to 28.6 cents in late Tuesday activity.