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 February 24, 2010 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$1,000,000,000 filed with the United States Securities and Exchange Commission on November 18, 2010 (the "Prospectus") and to the incorporation by reference therein of our reports dated February 23, 2010 with respect to the consolidated financial statements of the Corporation for the year ended December 31, 2009 and the effectiveness of internal control over financial reporting as of December 31, 2009 included in the Corporation's Annual Report to Shareholders, filed with the United States Securities and Exchange Commission.
We also consent to the use, through incorporation by reference, in the above mentioned Prospectus of our report to the Board of Directors of the Corporation with respect to the Reconciliation to United States Generally Accepted Accounting Principles as at December 31, 2009 and 2008 and for each of the years in the three year period ended December 31, 2009. Our report is dated February 23, 2010.
| | |
Calgary, Canada | | /s/ ERNST & YOUNG LLP |
November 18, 2010 | | Chartered Accountants |
QuickLinks
CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM