Bnei Yisrael were given two mitzvos to perform before their redemption from Mitzrayim: bris milah and korban Pesach. Included in the mitzvah of Korban Pesach was the commandment to place the lamb's blood on the two doorposts and the lintel. Regarding this commandment the Torah tells us, "And the blood will be a sign for you upon the houses that you are in. And I will see the blood, and I will pass over you, and there will be no plague of destruction when I smite in the land of Egypt" (Shemos 12, 13).
Did Hashem really need a sign to be able to distinguish between a Jewish home and the house of an Egyptian? Rashi, citing Chazal, explains as follows. "Everything is revealed before Him, and yet, Hashem said, 'I will place My eyes upon you to see if you are occupied with My mitzvos, and [then] I will pass over you.'"
Rav Wolbe (Shiurei Chumash) comments that Chazal are enlightening us to the spiritual mechanics of the mitzvos. Had Bnei Yisrael not placed the blood on the doorposts as commanded, they would have perished along with the Egyptians. Even though Hashem certainly has no problem distinguishing between the Jew and the Egyptian, He would not have done so had He not seen the Jew engaged in the performance of His mitzvos.
So Hashem doesn't need a sign to distinguish the occupants' nationality, but He does need our mitzvos?! The answer once again is, certainly not, since Hashem does not gain from our performance of the mitzvos. Nevertheless, He intertwined Divine Providence with the performance of mitzvos, and therefore, His intervention is contingent on our deeds. Had they not placed the blood on the doorposts, they would not have merited the Divine protection afforded those that keep Hashem's mitzvos.
Every mitzvah performed and each bracha recited brings blessing and bounty to the world. The course of nature is subservient to the guardians of the Torah, and all that occurs is a direct result of the observance or, G-d forbid, the lack of observance of the Torah and mitzvos. As clearly demonstrated in Mitzrayim, this rule holds true with even one single mitzvah. Their lives were spared because they had fulfilled the mitzvah of korban Pesach exactly as commanded. Precision in mitzvos garners Divine intervention.