One of the two ways for a federal court to gain subject-matter jurisdiction over a case, the other being diversity jurisdiction. Generally, in order for federal question jurisdiction to exist, the cause of action must arise under federal law. More specifically, however, there are both constitutional and statutory requirements that must be met before jurisdiction can be found.
Under Article III of the Constitution, federal courts can hear "all cases, in law and equity, arising under this Constitution, [and] the laws of the United States..." US Const, Art III, Sec 2. The Supreme Court has interpreted this clause broadly, finding that it allows federal courts to hear any case in which there is a federal ingredient. Osborn v. Bank of the United States, 9 Wheat. (22 U.S.) 738 (1824).
For federal question jurisdiction to exist, the requirements of 28 USC 1331 must also be met. This statute gives federal courts jurisdiction only to those cases which "aris[e] under" federal law. 28 USC 1331. This requirement has been found to be narrower than the requirements of the constitution. The Supreme Court has found that a "suit arises under the law that creates the cause of action," American Well Works v. Layne, 241 US 257 (1916), and therefore, only suits based on federal law, not state law suits likeley to provoke a federal law defense, create federal question jurisdiction, Louisville & Nashville R. Co. v. Mottley, 211 U.S. 149 (1908).