Foreign earned income is income you receive for services you perform in a foreign country or countries. It does not matter whether the income is paid by a U.S. employer or a foreign employer. To qualify for the foreign earned income exclusion, two main requirements must be met:
Foreign earned income includes wages, salaries, professional fees, and other amounts received as compensation for personal services actually rendered (Subsection 911(d)(2)(A)). However, it does not include amounts received as a pension or annuity, paid by the United States or an agency thereof to an employee of the United States or an agency thereof, included in gross income by reason of section 402(b) or section 403(c), or received after the close of the taxable year following the taxable year in which the services to which the amounts are attributable are performed (Subsection 911(b)(1)(B)).
In summary, foreign earned income is defined by the location where the services are performed, not by the source of the payment.
Sources:
Publication 54 (2023)
§ 911. Citizens or residents of the United States living abroad
Publication 519 (2023)
Rev. Rul. 75-432
IRM Part 21. Customer Account Services. Chapter 8. International. Section 1. IMF International Adjustments
CCA 201810007