EX-5.1 2 a2211965zex-5_1.htm EX-5.1
QuickLinks -- Click here to rapidly navigate through this document


Exhibit 5.1


CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM

        We consent to the reference to our firm under the caption "Interests of Experts" in the Annual Information Form dated March 1, 2012 which is incorporated by reference in the Registration Statement on Form F-10 and related base shelf prospectus of TransAlta Corporation (the "Corporation"), relating to the registration of Common Shares, First Preferred Shares, Warrants to purchase Common Shares, First Preferred Shares or other securities, Subscription Receipts, each of which, once purchased, entitle the holder to receive upon satisfaction of certain release conditions, and for no additional consideration, one Common Share, or Debt Securities, up to an aggregate initial offering price of US$2,000,000,000 filed with the United States Securities and Exchange Commission on November 27, 2012 (the "Prospectus") and to the incorporation by reference therein of our reports dated March 1, 2012, with respect to the consolidated financial statements of the Corporation which comprise the consolidated statements of financial position as at December 31, 2011 and 2010, and January 1, 2010, and the consolidated statements of earnings, comprehensive income, changes in equity and cash flows for the years ended December 31, 2011 and 2010, and the effectiveness of internal control over financial reporting of the Corporation, incorporated by reference into its Annual Report (Form 40-F/A) for the year ended December 31, 2011, filed with the Securities and Exchange Commission.

Calgary, Canada

  /s/ Ernst & Young LLP

November 27, 2012

  Chartered Accountants



QuickLinks

CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM