As with many extant Greek tragedies, we have no exact date for the the writing of Electra, though scholars have argued that some of its stylistic features suggest it was written towards the end of Sophocles' life.
The story of Orestes' revenge is a fascinating one, not least because it is perhaps the only story for which we have a complete surviving treatment from each of the three major Greek dramatists: Sophocles, Aeschylus, and Euripides. Homer delves briefly into the story of Orestes' matricide in the Odyssey, but it is not until Aeschylus' Oresteia, a play against which Electra must be read to unlock its full richness, that the Orestes story is really explored in depth. Aeschylus' play has Orestes, after the death of Clytemnestra, pursued by Furies (personifications of the anger of the dead) and eventually brought to trial before Athene, a trial in which the rights and wrongs of what he has done are weighed and considered. Euripides' version is markedly different from Aeschylus' and Sophocles' treatments -- though it shares Sophocles' name, Electra. Euripides' play pokes fun at Homer, and (it seems) at previous versions of the myth, though it is important to note that scholars do not know whether Sophocles' or Euripides' version came first.
When compared to Aeschylus' Oresteia and Euripides' Electra, Sophocles' treatment of the story is unusual for several reasons. First, it takes a story which Aeschylus had centered around Orestes, and entirely changes its focus to Electra. Thus, the play as Sophocles writes it becomes less about patterns of vengeance and abstract (or divine) ideals of justice and revenge, and more about humans. What we see most clearly through Sophocles' focus on Electra herself is the product of the unpleasant circumstances she has been forced to live through.
Second, Sophocles omits Aeschylus' justice from his play, and makes no final arbitration about whether or not Orestes' matricide is just or justified. There are no Furies, no final trial, and no vote by the jurors or by Athene. The gods, indeed, are reduced to simple Oracles and prophecies, and make no direct appearance. This is a tragedy on a particularly human scale, even to the extent that the final judgment must be made by the audience, not by the gods. Sophocles asks questions, but provides no answers.
Third, and perhaps most significant, Sophocles' Electra is a strikingly different character from her counterparts in Aeschylus and Euripides. She is bitter, angry, furious, and decidedly "unfeminine" in the traditional ancient Greek sense. She spends the whole play outside, refusing to go inside the house. She is, it has often be argued, not a sympathetic protagonist, but one still somehow admirable if only by the sheer force of her will. She is Electra recast as a Sophoclean protagonist: extreme in nature, refusing to compromise or back down, and willing to pursue her desires to the very end, regardless of the cost to herself or the morality of the outcome. The other characters, as David Grene has written, are included "principally so that we should know more about [Electra] when we see her dealing with them". Sophocles' is thus a personal play, rather than a play about events; yet - like all great drama - its themes touch both broad and intimate subjects. It is, Grene goes on to argue, "the best-constructed and most unpleasant play that Sophocles wrote."