In every division of the Old Testament scriptures, the law always refers to the five books of Moses known as the Pentateuch: Genesis, Exodus, Leviticus, Numbers, and Deuteronomy.
However, there are different answers to what books are considered the prophets. For instance, in our English Bible, the prophets are the last 17 books of the Old Testament: Isaiah through Malachi. This first five books in this series (Isaiah through Daniel) are called the Major Prophets and the last twelve books (Hosea through Malachi) are called the Minor Prophets.
It is important that we understand the meaning of major and minor in this context. Originally, major referred to that which was larger or of greater quantity and minor referred to that which was smaller or of less quantity. They did not mean "more important" and "less important." A child who is a minor is not less important. He is a minor because he is younger and smaller and has not yet become an adult. The Major Prophets are major because they are longer books (Lamentations is included because it was written by Jeremiah) and the Minor Prophets are minor because they are shorter books. The Minor Prophets are also included together because they were usually combined in one scroll in the ancient Hebrew scriptures.
When we think of the Law as the five books of Moses and the prophets as the last 17 books of the Old Testament, we still have 17 books left over. Most Bible teachers called the twelve books from Joshua through 2 Chronicles the Books of History and the five books from Job through Song of Solomon the books of Wisdom. However, that does not explain the New Testament references to the Old Testament books. The reason is simple: the Hebrew scriptures, although they had the exact same books as we have today in the Old Testament, were divided differently than they are in our English Bible. There were other differences. A number of books that we have as separate books were combined into single books and this gave a total of 24 books (not the 39 we have today). For instance, all twelve minor prophets were combined into one book. And, the books were in a different order than we have today. One of the most interesting things about the book order of the Hebrew scriptures is that they finished with 1 and 2 Chronicles; not with Malachi.
But we need to get back to the question at hand. The New Testament refers to the division of the Old Testament books in two ways. Most often, the Old Testament is referred to as the law and the prophets (see Matthew 5:17; 7:12; 22:40; John 1:45; Acts 13:15; 24:14; 28:13; Romans 3:21). On one occasion, Jesus used the threefold division that was known to the Jews of the time: "And he said unto them, These are the words which I spake unto you, while I was yet with you, that all things must be fulfilled, which were written in the law of Moses, and in the prophets, and in the psalms, concerning me" (Luke 24:44). In the terminology of the time, what is here called the "psalms" was also called the "writings." In order to understand these divisions, we need to look at the threefold division first.
When Jesus referred to the law, the prophets, and the psalms, He was speaking of the entire Old Testament. The Law, as in other places, referred to the five books of the law written by Moses. The prophets, however, were not the same as found in our Bibles today. They included Isaiah, Jeremiah, and Ezekiel (but not Jeremiah and Daniel) and all of the twelve minor prophets. But they also included Joshua, Judges, 1 and 2 Samuel, and 1 and 2 Kings. This would place 21 books of the Old Testament in the Prophets according to our modern reckoning. Why some of the books of history were included and others were not and why Daniel was excluded is not fully understood and I am not ready to go into the complications of these questions here.
The third division in the Hebrew Bible was normally called the Writings. Jesus in Luke 24:44 used the title of Psalms; a title that came from the first, the largest and the most prominent book in this division. This division was subdivided into three sections. The first section included Psalms, Proverbs, and Job. The second section included Song of Solomon, Ruth, Lamentations, Ecclesiastes, and Esther. The third section included Daniel, Ezra, Nehemiah, and 1 and 2 Chronicles. This gave this division 13 books according to the modern division of books.
The question might now arise as to whether or not the New Testament references to the law and the prophets left out this last division. It did not. Since anyone used by God to write a portion of sacred scripture was considered a prophet, a reference to the law and the prophets was a shortened reference to the entire Old Testament. For instance, in Luke 24:27, Jesus expounded all things concerning Himself in "Moses and all the prophets." However, towards the end of the conversation He announced that He had told them (past tense) the things "which were written in the law of Moses, and in the prophets, and in the psalms, concerning me" (Luke 24:44). Both expressions refer to the entire Old Testament scriptures.