In February 1685, the order of the Succession to Charles II of Spain was the following one :
1.Louis le Grand Dauphin, Dauphin of France (Born 1661, aged 24) - The eldest son of Maria Theresa of Spain and Louis XIV. Technically, he was first in line since he Maria Theresa was the eldest sister of Charles II. Yet, since his coronation would have led to a de facto Personnal Union of France and Spain, I don't think he would take the crown for himself.
2.Louis le Petit Dauphin, Duke of Burgundy (Born 1682, aged 3) - Eldest son of Louis le Grand Dauphin. Having him succeed the throne woudn't be easy as he is a baby. Plus, it would still pose the same problem of the Franco-Spanish Personnal Union as he is second in line for the French throne.
3.Philippe, Duke of Anjou (Born 1683, aged 2) - Second son of Louis le Grand Dauphin and the one who became OTL Philip V of Spain. Like his brother, he is too young. However, he is the first Bourbon who can claim the crown without leading to a Personnal Union of France and Spain (at least at the time).
4. Maria Antonia of Austria (Born 1669, aged 16) - Daughter of Margarita Theresa of Austria and Holy Roman Emperor Leopold I. She married Maximilian II of Bavaria in July 1685. In my opinion, she would be the most suited candidate : she is a Hapsburg, but married to a Wittlesbach who were generally pro-French : an agreement could thus be reached with both parties. Problem is that she died on December 24, 1692 and her only surviving son, Joseph Ferdinand, was born on October 28, 1692 and died on February 6, 1699. This would thus lead to problems later if the butterflies are not strong enough to have Joseph Ferdinand survive or for Maria to live long enough to give birth to other children.
5. Louis XIV "the Sun King" of France (Born 1638, aged 47) - Since Louis XIV's mother is Anna of Austria, the eldest sister of Philip IV (and thus Charles II's aunt), Louis XIV finds himself in the Spanish order of Succession. There's no point debating his candidacy : this would lead to a Franco-Spanish Personnal Union and besides, he has relatives that are in a better position than himself.
6. Monsieur Philip, Duke of Orléans (Born 1640, aged 45) - Louis XIV's younger brother. However, Louis wasn't very fond of his brother so I'm not sure he would do. Yet again, after Philip of Anjou, he is the second Bourbon that could get the French throne without leading to a personnal union between France and Spain.
7. Philip of Orléans (Born 1674, aged 11) - The Duke of Orléans' only surviving son.
8. Marie Louise of Orléans, Queen of Spain (Born 1662, aged 23) - The Duke of Orléans' eldest daughter and Charles II's wife. Quite Ironic if she were to find herself on the throne...
9. Anne Marie of Orléans (Born 1669, aged 16) - The Duke of Orléans' second daughter. Married to Victor Amadeus II of Savoy. Her first child wasn't born before December 1685.
10.Elisabeth Charlotte of Orléans (Born 1676, aged 9) - The Duke of Orléans' youngest daughter.
11. Leopold I, Holy Roman Emperor (Born 1640, aged 45) - The first male Hapsburg candidate, son of Maria Anna of Hapsburg (Another aunt of Charles II) and Holy Roman Emperor Ferdinand III. Like Louis XIV, his candidacy is out of the question as you would end up with a reunified Charles V Empire. Like Louis XIV, he has the peculiar particularity of being in the order of succession after one of his children (in this case, Maria Antonia of Austria)
12. Joseph, Archduke of Austria (Born 1678, aged 7) - First son of Leopold I and his heir. Probably won't be a candidate as he is young and the current heir to the Imperial throne (although he isn't yet King of the Romans, he has great chances of becoming it as it was de facto hereditary).
Archduke Charles, the OTL candidate to the Spanish throne for the Hapsburg, wasn't born before October 1685, but he should be placed after Joseph.
13. Maria Elisabeth of Hapsburg (Born 1680, aged 5) - Second daughter of Holy Roman Emperor Leopold I.
14. Maria Anna of Hapsburg (Born 1683, aged 2) - Third daughter of Holy Roman Emperor Leopold I.
15. Maria Theresa of Hapsburg (Born 1684, aged 1) - Fourth daughter of Holy Roman Emperor Leopold I.
16. Marianna of Austria, Queen Mother of Spain (Born 1634, aged 61) - Sister of Holy Roman Emperor Leopold I, wife of her uncle Philip IV of Spain and thus mother of Charles II of Spain.
Aside from telling you I find this family tree the messiest I have ever seen, I'll tell you that the death of Charles II in 1685 would lead to a problem...
There probably would be a consensus of giving the throne to Maria Antonia of Austria to avoid conflicts. Problem is that she would rule for seven years before leaving a two-months old baby who would rule for another seven years as Joseph I of Spain before dying in infancy if things go OTL... After that, we would probably end up with an ATL War of Spanish Succession in 1699.
Even if James II is King of Britain and friendly to his cousin Louis XIV, he won't wish for a situation of a Franco-Spanish Bourbon Empire that could be a nuisance to Britain. Parliament is sure to go against him if he allows this.
European powers are going to look at the matter carefully : given the order of succession, no one will want a Franco-Spanish Union, but they will also wish that Charles V's Empire isn't resurrected. However, avoiding one or the other scenario isn't easy...
And even with a favorable Maria Antonia scenario (meaning no OTL deaths for her or her son), you would have to give compensations to Louis the Grand Dauphin and France since they are technically the first in line. In one of the partitions, he (or his cadet son Philip, I'm not sure) was supposed to get Milan and Naples : that would probably do in this scenario.