If you are a United States citizen with a tax home in a foreign country and you meet the bona fide residence test or physical presence test, you may exclude up to the maximum limit allowed for the taxable year.
The example above I took from the IRS Topic word-by-word.
To be eligible to claim the foreign earned income exclusion or the foreign housing exclusion, you must have a tax home in a foreign country and meet either the bona fide residence test or the physical presence test. The bona fide residence test is described above.
The physical presence test can be used by any United States citizen or resident alien. You must be physically present in a foreign country or countries for at least 330 full days during any period of 12 consecutive months. The 12-month period can begin with any day of any calendar month.
Based on your description you satisfy both tests and are eligible for excusion. The maximum annual exclusion is prorated on a daily basis if there is any part of the year that you do not qualify under either test.
I would also suggest to read the IRS publication 54 - http://www.irs.gov/pub/irs-pdf/p54.pdf
If the period for which you qualify for the foreign earned income exclusion includes only part of the year, you must adjust the maximum limit based on the number of qualifying days in the year. The number of qualifying days is the number of days in the year within the period on which you both:
- Have your tax home in a foreign country, and
- Meet either the bona fide residence test or the physical presence test.
For this purpose, you can count as qualifying days all days within a period of 12 consecutive months once you are physically present and have your tax home in a foreign country for 330 full days. To figure your maximum exclusion, multiply the maximum excludable amount for the year by the number of your qualifying days in the year, and then divide the result by the number of days in the year.
Example. You report your income on the calendar-year basis and you qualified for the foreign earned income exclusion under the bona fide residence test for 75 days in 2007. You can exclude a maximum of 75/365 of $85,700, or $17,610, of your foreign earned income for 2007. If you qualify under the bona fide residence test for all of 2008, you can exclude your foreign earned income up to the 2008 limit.