Federal question jurisdiction is one of the two ways for a federal court to gain subject-matter jurisdiction over a case (the other way is through 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.
Interpreting "Arising Under" - Constitutional Requirement
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).
28 USC 1331 - The Statutory Component
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, are most likely to create federal question jurisdiction, Louisville & Nashville R. Co. v. Mottley, 211 U.S. 149 (1908).
Well-Pleaded Complaint Rule
Typically, in order to have federal question jurisdiction, the plaintiff's complaint must be a well-pleaded one. This means that the plaintiff's initial complaint must contain the references to the federal question and the federal issue evoked. The federal question and issue cannot arise in an anticipated defense, it must be presented from the initial complaint. This requirement was established in Louisville & Nashville R. Co. v. Mottley, and as such it is often referred to as the "Mottley Rule."
Another test that courts will often use to determine federal question jurisdiction is called the Grable Test, established in Grable & Sons Metal Products, Inc. v. Darue Engingeering & Manufacturing. This is a two-part test