We can see this from the signal, "my brethren," which James uses repeatedly throughout the book in various forms to set off various pericopes. James uses it once in verse 14 and then again at verse 1 of chapter 3 (the verse after James 2:26).
We can also see this from the subject matter of the pericope. Within the pericope, James mentions faith or believe (or some form thereof) about a dozen times, whereas James' only mentions faith a few times outside the pericope.
Nevertheless, while the pericope is an entity to itself, it also has a context within James as a whole (Wisdom literature with a central theme of demonstrated faith) and an immediate context.
The immediate context of Faith/Works pericope is the preceding respect-of-persons pericope (James 2:1-13) and the following tongue-bridling pericope (James 3:1-10). The respect-of-persons pericope generally deals with the importance of not discriminating against poor people in favor of rich people. By contrast, the tongue-bridling pericope deals with the importance of controlling one's tongue, as being the most difficult to control and dangerous part of the body. Nevertheless, they both have some common threads.
The respect-of-persons argument argues for the seriousness of the sin of discriminating against the poor by arguing that a violation of any aspect of the law is a violation of the law as a whole: "For whosoever shall keep the whole law, and yet offend in one point, he is guilty of all." (James 2:10) Accordingly, James counsels that we should speak and act as those who will be judged by what James calls "the law of liberty," (James 2:12) warning that "he shall have judgment without mercy, that hath shewed no mercy; and mercy rejoiceth against judgment." James 2:13). Similarly, the tongue-bridling pericope begins by confessing that we have many offenses ("in many things we offend all" James 3:2), focusing on offenses of the tongue, which James says no man can tame (James 3:8).
Thus, both passages deal with the sinfulness of men and the inadequacy of men to keep the law. The references to tongue-bridling and the law of liberty actually hearken back to James 2:22-27, which states:
But be ye doers of the word, and not hearers only, deceiving your own selves. For if any be a hearer of the word, and not a doer, he is like unto a man beholding his natural face in a glass: for he beholdeth himself, and goeth his way, and straightway forgetteth what manner of man he was. But whoso looketh into the perfect law of liberty, and continueth therein, he being not a forgetful hearer, but a doer of the work, this man shall be blessed in his deed. If any man among you seem to be religious, and bridleth not his tongue, but deceiveth his own heart, this man's religion is vain. Pure religion and undefiled before God and the Father is this, To visit the fatherless and widows in their affliction, and to keep himself unspotted from the world.In other words, the bridling of the tongue is part of the obedience to the law of liberty, as is care for the needy.
When it comes to the Faith/Works pericope, we will see care of the poor as an example, which tends to tie that pericope together with the pericopes before and after it, since care of the poor is part of obedience to that law of liberty.