From the facts you give, you are clearly entitled to the exemption. The rules for determining the exemption in your case are from Treasury Regulation Sec. 1.152-4 Support test in case of child of divorced or separated parents:
The test for who gets the exemption for a child of divorced or separated parents is based on the special rules if all of the following are true.
1) The parents are divorced or legally separated under a decree of divorce or separate maintenance, or separated under a written separation agreement, or lived apart at all times during the last 6 months of the calendar year.
2) One or both parents provide more than half of the child's total support for the calendar year.
3) One or both parents have custody of the child for more than half of the calendar year.
Under the special rule, the parent who has custody of the child for the greater part of the year is entitled to the exemption. It does not matter whether the custodial parent actually provided more than half of the support.
For this rule, custody is usually determined by the terms of the most recent decree of divorce or separate maintenance, or a later custody decree. If there is no decree, use the written separation agreement. If neither a decree nor agreement establishes custody, then the parent who has the physical custody of the child for the greater part of the year is considered to have custody of the child. This also applies if the validity of a decree or agreement awarding custody is uncertain because of legal proceedings pending on the last day of the calendar year.
The noncustodial parent would be entitled to the exemption under this rule only if:
1) The custodial parent signs a written declaration that he or she will not claim the exemption for the child, and the noncustodial parent attaches this written declaration to his or her return, or
2) A decree or agreement went into effect after 1984 and states the noncustodial parent can claim the child as a dependent without regard to any condition, such as payment of support.