In Bilam’s second blessing to Benei Yisrael, he compares the nation to lion that rises from its sleep (“Hein am ke-lavi yakum ve-kha’ari yitnasa” – 23:24). Rashi explains this analogy as a reference to the mitzvot we perform each morning: “When they arise from their sleep in the morning, they are mighty like a lion…to grab the mitzvot – to wear a tallit, to read Shema, and to lay tefillin.”
Several writers noted that Rashi here lists the morning mitzvot in the wrong sequence, mentioning the recitation of Shema before wearing tefillin. The Gemara (Berakhot 14b) states explicitly that one should not recite Shema without wearing tefillin, as by doing so, he “falsely testifies about himself.” As the text of Shema includes references to the mitzva of tefillin, one who recites Shema without wearing tefillin gives the impression that he speaks falsely and does not truly believe the text he recites. Yet, Rashi reverses the sequence, mentioning Shema before tefillin.
In truth, some editions of Rashi’s commentary feature a different text, listing tefillin before Shema. This is also the sequence that appears in the Midrash Tanchuma, the source of Rashi’s comment.
A fascinating explanation for the sequence that appears in the common editions of Rashi is offered by Rav Yitzchak Shmelkes, in his Beit Yitzchak (O.C. 17). The context of his discussion is the custom which many Jews apparently followed in his time, to recite all three paragraphs of Shema immediately upon awakening in the morning, before putting on tefillin. To justify this custom, Rav Shmelkes suggests that Halakha perhaps does not accept the ruling cited by the Gemara that Shema should be recited only after one puts on his tefillin. He cites the ruling of the Nimukei Yosef, brought by the Beit Yosef (O.C. 25), that one must put on tzitzit before tefillin, because of the famous rule of “tadir ve-she’eino tadir, tadir kodem” – more frequent mitzvot are performed before less frequent mitzvot. As the mitzva of tefillin does not apply on Shabbat and Yom Tov, it is less frequent than tzitzit, and therefore, one should perform the mitzva of tzitzit before performing the mitzva of tefillin. According to this rationale, Rav Shmelkes writes, we should also fulfill the mitzva of Shema before the mitzva of tefillin, as Shema is recited even on Shabbat and Yom Tov, whereas the mitzva of tefillin does not apply on Shabbat and Yom Tov. Rav Shmelkes explains that when the Gemara in Masekhet Berakhot required putting on tefillin before reciting Shema, it was following the view cited in Masekhet Eruvin (95b) that the mitzva of tefillin is applicable even on Shabbat and holidays. According to this view, the obligation of Shema does not apply more frequently than tefillin, and thus the view cited by the Gemara in Berakhot felt that tefillin should be put on before Shema, so that they will be worn at the time when one mentions the tefillin obligation while reciting Shema. Halakha, however, does not accept this view, and we do not wear tefillin on Shabbat and Yom Tov. According to the accepted practice, then, Shema applies more frequently than tefillin, and this is the reason underlying the custom to recite Shema right when one awakens, before putting on tefillin. Rav Shmelkes suggests that this might be the reason why Rashi in Parashat Balak mentions Shema before tefillin, as Shema applies more frequently and thus should, according to this analysis, be recited before one puts on his tefillin.