Which Comes First?
In every eight days of Chanukah there must be at least one Shabbos. Before that Shabbos begins we have two mitzvos related to candles - Shabbos lights and Chanukah lights.
Which comes first in importance and which in order of performance?
The issue of relative importance arises in a situation where one has limited funds and can afford to buy only candles for Shabbos or Chanukah. Which deserves priority?
Resolution of this issue, declared the Sage Rava, is a simple matter. Shabbos candles take priority because of "Shalom bayis" (the family is uncomfortable sitting in the dark - Rashi). This ruling, codified in the Shulchan Aruch (Orach Chaim 678:1), is modified by the later authorities who write that although it is proper to light at least two candles in honor of Shabbos, in a case of limited funds it is preferable to make do with only one Shabbos candle and to use the remaining funds to purchase a candle for Chanukah.
When there are sufficient funds for both, but it is only a question of the order of performance, the Shulchan Aruch (Orach Chaim 679:1) rules that the Chanukah candles should be lit before the Shabbos ones. The reason for this is because there is a halachic opinion that once you light the Shabbos candles you have accepted upon yourself the sanctity of the Sabbath and are now forbidden to light the fire necessary for the Chanukah lights.
Since a man does not customarily light the Shabbos candles, his lighting them by mistake before the Chanukah ones will not prevent him from subsequently lighting the Chanukah candles unless he expressly thought of accepting the sanctity of the Sabbath. If it is a woman lighting the Chanukah candles because her husband is away, we consider her lighting of Shabbos candles as an acceptance of Sabbath sanctity just as it is every erev Shabbos throughout the year. If she mistakenly lights the Shabbos candles first she should therefore ask someone else to light the Chanukah ones for her, and also to say the first blessing upon them. She herself should say the other one (or two if it's the first night of Chanukah).