Halacha forbids wearing Tefillin at nighttime. Although no Torah prohibition is entailed by donning Tefillin during the night, the Sages enacted such a prohibition out of concern that one might fall asleep while wearing Tefillin, which would be disrespectful for the special sanctity of the Tefillin. (See Shulhan Aruch, Orah Haim 30.)
The question arises, if a person did not, for whatever reason, wear Tefillin during the day until after sundown, should he put on Tefillin during Ben Ha'shemashot – the 18-minute period after sundown? The period of Ben Ha'shemashot is treated in Halacha as a period of doubt, as we are uncertain whether to consider it daytime or nighttime. Thus, in a case where one had not worn Tefillin the entire day, should he wear Tefillin during Ben Ha'shemashot, given that the day may have not yet ended, or must he refrain from wearing Tefillin, in light of the possibility that the night has already begun?
Hacham Ovadia Yosef, in his work Halichot Olam (vol. 1, p. 29; listen to audio for precise citation), rules that in such a case one should, in fact, don Tefillin during Ben Ha'shemashot, and should even recite the Beracha. He explains that in this case there are two possible reasons to allow the individual to wear Tefillin. Firstly, as mentioned, the period of Ben Ha'shemashot may have the Halachic status of daytime, in which it is permissible to wear Tefillin. Secondly, Rabbenu Tam (France, 1100-1171) was of the opinion that Ben Ha'shemashot does not begin until an hour or so after sunset. Hence, if 18 minutes have not passed since the sun set, then Ben Ha'shemashot has yet to begin according to the view of Rabbenu Tam, and thus one may certainly still wear Tefillin. Hacham Ovadia rules that since we have two possible bases for allowing wearing Tefillin during the 18 minutes after sundown, we may allow a person in such a case to do so, and he may even recite a Beracha. An exception to this rule is a case where the individual has already recited Arbit. As Hacham Ovadia cites from numerous earlier authorities, once a person recited Arbit he cannot recite the Beracha over Tefillin. He may still wear Tefillin – assuming that 18 minutes have not passed since sundown – but he may no longer recite the Beracha once he has prayed Arbit. Hacham Ovadia adds that even before sundown, one who already recited Arbit may no longer recite the Beracha over Tefillin.
Summary: It is forbidden to wear Tefillin at nighttime. If a person did not wear Tefillin the entire day until after sunset, and 18 minutes have not yet passed since sunset, he should put on his Tefillin with the Beracha, unless he had already recited Arbit, in which case he puts on Tefillin without the Beracha.