The context is exactly the same, but the numbers are different.
Isn't this a contradiction?
As other answers have noted, there are a number of discrepancies between the lists of Ezra 2 and Nehemiah 7 which are, largely, duplicate passages.
In the case of Ezra 2:65 and Nehemiah 7:67, there is a specific textual circumstance to explain the present text. At some very early point in Nehemiah's transmission, a scribe's eye has jumped from the "200" of verse 67, to the "200" of verse 68. Consider the equivalent text from Ezra 2:
Notice the last word of 2:65, and how it is repeated later in 2:66 (indicated with the thin blue lines in that image), from מאתים to מאתים. For Nehemiah, the scribe's eye has followed the red arrow, resulting the omission of the text highlighted in blue, leaving a text reading "245". The technical term for this scribal mistake is "parablepsis".
Some Hebrew manuscripts and ancient translators were aware that there was missing material in Nehemiah 7, so added in the "missing" verse, but without correcting the mistaken "245" back to "200".
Note that most English versions (there are three in the example at that link) include a textual note on Nehemiah 7:68 to point out that it is present only in some Hebrew manuscripts and ancient versions.
"Obviously" this is contradiction.
One contradiction that can be explained in different ways.
Simple scribal error. Very unsatisfactory answer, but possible, however likely, or unlikely.
From within the text or concordant with the narrative. We have two different people acting here: Ezra and Nehemiah. They may have counted differently or at different times to arrive at 17 discrepancies in the numbers given:
The most likely cause of the difference is that Ezra recorded those who left for Israel from Babylon. Many scholars believe that Ezra's list was compiled in Babylon before the people actually left. Of course, in any large crowd things happen. People who start to leave get ill and have to stay behind. Some die, some are born. Some didn't leave with the group, but joined it while it was in progress. Nehemiah had a list of who arrived in Jerusalem, but his list was for a later time. "Then it was, when the wall was built and I had hung the doors, when the gatekeepers, the singers, and the Levites had been appointed, ..." (Nehemiah 7:1). In other words, Nehemiah recorded those who came from Babylon at the time the walls in Jerusalem were finished. His list was based on the earlier list, but updated to the current numbers. This would also explain the shift from children to men in some of the entries. In the time that elapsed, people would have died and been born giving a different number of people currently in Jerusalem.
Therefore, the clearest answer is that Ezra and Nehemiah records are for a similar event but recorded at different moments in time.
From textual history of the two books that were once and sometimes are counted as one.
When this text, or these texts were combined and regarded as scripture for what we call Old Testament, the scribes frequently left in apparent contradictions as seemingly each strand of the tradition is equally sacred and not to be changed any more. The bible starts right away with two accounts of creation that do not quite match, but are said to account for different versions of the same story. Ezra-Nehemiah is no less rich in this regard of its history (and alas, possible theories):
Hugh G. M. Williamson (1987) sees three basic stages to the composition of Ezra–Nehemiah: (1) composition of the various lists and Persian documents, which he accepts as authentic and therefore the earliest parts of the book; (2) composition of the "Ezra memoir" and "Nehemiah memoir", about 400 BC; and (3), composition of Ezra 1–6 (the story of Zerubabbel) as the final editor's introduction to the combined earlier texts, about 300 BC.
More recently Juha Pakkala (2004) has carried out an extensive analysis of the layers in Ezra. He sees the account of the rebuilding of the Temple (Ezra 5:1–6:15) and the core of the "Ezra memoir" (Ezra 7–10/Nehemiah 8) developing separately until they were combined by an editor who wished to show how Temple and Torah were re-introduced into Judah after the exile. This editor also added Ezra 1–5. The combined text was then further developed by priestly circles who stressed Temple over Torah, transformed Ezra from scribe to priest, and stressed the primacy of the Babylonian returnees over those who had remained in the land, a distinction that had not appeared in the original Ezra material. Still later, Levitical editors combined Ezra and Nehemiah to produce the final form of the book, reintroducing interest in Torah and stressing the primacy of the Levites.
Jacob Wright (2004) has carried out similar work on Nehemiah. According to his study the original "Nehemiah memoir" was an account of the rebuilding of the city walls. Successive layers were then added to this, turning the building report into an account of Judah's restoration and depicting Nehemiah as a Persian governor who reforms the community of Israel. Finally, after Ezra had come into existence through the combination of Ezra 1–6 with Ezra 7–10, the accounts of the repopulation and dedication of the city and the friction between Temple and torah were added to produce the final book of Nehemiah. Furthermore, Wright's article his main issue is of course the literature of the text. The argument comes when Nehemiah notices that the Judeans were marrying people outside of their lands (exogamy) whose children spoke the same language. Although this came during the 52 days of the construction of the wall, we are not sure how he noticed the issue. The non clarity in the text according to Wright is as if Ezra already outlawed Judean men not to marry any one outside of their land, then why is Nehemiah noticing it thirteen years later. According to Wright the issue in Ezra 9–10 is in the verse 24, where it says that half of the children spoke another language and did not know the language of judah. Even though the issue in the text says it is not worried about the survival of the Judean language Nehemiah cannot endorse the exogamous marriage. After punishing the men, that is when he makes them take the oath however Wright's argument is if Nehemiah actually composed that text, in which he did not know a passage in Deuteronomy, then why does he compose an oath that does not match the issue that was in the previous verse.
Lester Grabbe (2003), based on various factors including the type of Aramaic used in the youngest sections and the ignorance of Ezra–Nehemiah as a single book displayed by other Hellenistic Jewish writers, suggests that the two texts were combined, with some final editing, in the Ptolemaic period, c. 300 – c. 200 BC.
From Wikipedia: Ezra–Nehemiah – Composition History
On the detail of the number of singers, all of the textual evidence is in agreement: Nehemiah has recorded 245 and Ezra 200. There is no textual evidence to support treating these numbers as other than original to each. However, it is misleading to claim there is a contradiction solely on the fact the numbers are different. After all, if there were 245, then there were 200. This lack of agreement can not arbitrarily be called a contradiction, especially since they do agree on an important detail: the singers were both male and female.
This is significant because these appear to be the only specific references to female singers after the Ark was brought to Jerusalem. In that case we have two texts which are in agreement on a unique detail: recognizing female singers after formal cultic practices were established in Jerusalem. Given a role which is otherwise described as male only, this point of agreement is good reason against calling the two a contradiction.
In her commentary of Ezra, Hindy Najman says:
Nehemiah 7.5 titles this list "the genealogical register of those who were first to come up." Although both lists purport to record the same group of returnees, they exhibit significant differences. Scholars suggest that both lists were in fact complied later than the first wave of return, on the basis of either censuses or tax registers. 1
So some understand the lists in Nehemiah and Ezra as a reflection of counts made at different times, or complied from different records.
Points of agreement support the suggestion no census was taken immediately upon arrival:
The number of the men of the people of Israel: the sons of Parosh, 2,172. (Ezra 2:2-3) [ESV]
The number of the men of the people of Israel: the sons of Parosh, 2,172. (Nehemiah 7:7-8)
The sons of Jericho, 345. (Ezra 2:34)
The sons of Jericho, 345. (Nehemiah 7:36)
Counting by ancestry could be done at departure, or during the journey before arrival; counting by location requires initial resettlement, after which it will take time for those taking the census to travel to all locations. This element common to both, suggests the method used to make and record the counts was by ancestry in Jerusalem and by location outside. In addition, unless all counts were done simultaneously, minor variances would be expected as a result of people traveling between locations (especially to/from Jerusalem). This appears to be the case:
The sons of Bethlehem, 123. The men of Netophah, 56. (Ezra 2:21-22)
The men of Bethlehem and Netophah, 188. (Nehemiah 7:26)
There are 3 differences between the two:
Minor variances would be expected if two counts were taken about the same time. In this case, one counter recorded two cites as one and the other separately. The numbers are different because someone left (or arrived) between counts. Minor variations can be taken as signs of authenticity and evidence one was not copied from the other. Rather two actual counts were made and recorded having minor variations typical for different census takers. Yet this does not mean the counts are contradictory, because both claim the same total:
The whole assembly together was 42,360 (Ezra 2:64)
The whole assembly together was 42,360 (Nehemiah 7:66)
Obviously variances due to travel between cities were reconciled.
The simplest explanation for all differences between the two lists is two concurrent counts were taken and complied.2 Given agreement on a number like 42,360 it is unlikely the period between the counts was years and the large number of identical counts support the premise counts were done concurrently by counters working independently. (Or they could have be taken from different types of records as Najman notes, we would only add the records must have reflect details from about the same time.)
From a practical perspective one count would start in Jerusalem and end in a city outside and the other would begin outside and end in Jerusalem. Everyone was counted only once but due to the amount of time required to make a complete count, some people were in a different location when the second counter made their count. 3 Finally, two different counts falls in line with the reoccurring theme characteristic of the resettlement: things are done in pairs. Some examples, in addition to Ezra and Nehemiah, there are two prophets, Haggai and Zechariah; the altar then the Temple are rebuilt; Ezra records a Passover celebration, and Nehemiah the Feast of Booths.
A comparison of the complete lists supports the reality the total number of singers reported in Nehemiah should be greater than reported in Ezra:
The singers: the sons of Asaph, 128. (Ezra 2:41)
The singers: the sons of Asaph, 148. (Nehemiah 7:44)
If one was aware of Ezra's total, they would also recognize Nehemiah's total of 245 is internally inconsistent. A larger count by 20 of the sons of Asaph leads one to expect a difference in the total count of 20, not 45. At the same time, it must also be noted this variance is specific to male singers.
If we accept Nehemiah and Ezra as having actual counts and place the singers in Jerusalem, there are two plausible explanations for the difference:
The first has some appeal as Levites did not reside in Jerusalem so travel to and from would be expected. However, this is wanting since it is unlikely all of the sons of Asaph who were singers would be in Jerusalem at the same time, or that the number of singers was not in fact the total number regardless of which city they were in when counts were made.
The second is more likely. The most important point is the presence of female singers. If a husband was removed from priestly duties, even temporarily, it is unlikely his wife and/or daughter(s) would be allowed to remain as a singer. Rather, the entire family would be affected. With this in mind, the difference of 20 sons of Asaph may also explain the 25 singers "missing" from Nehemiah's total: they were the wives and/or daughters of the 20.
Since we are not given the timing of the resolution of Levitical ancestry, we cannot state with certainty which of the two numbers were the "final" count. However, as Nehemiah in general reflects later actions, it would be consistent to see 245 as the later number. In this case, the Ezra count was lower due to the question over Levitical ancestry (as reflected in fewer sons of Asaph who were singers). In other words, a counter would not knowingly report someone as a Levite if there was any unresolved question and they were not counted in the initial count of singers. The resolution of Levitical ancestry increased the number of the sons of Asaph and the number of singers, as reflected in the Nehemiah total.
Finally, there is a hint of textual evidence the Nehemiah scribe is aware of the Ezra total and wants to alert the reader their total is in fact 245:
מִלְּבַד עַבְדֵיהֶם וְאַמְהֹֽתֵיהֶם אֵלֶּה שִׁבְעַת אֲלָפִים שְׁלֹשׁ מֵאֹות שְׁלֹשִׁים וְשִׁבְעָה וְלָהֶם מְשֹֽׁרֲרִים וּמְשֹׁרֲרֹות מָאתַיִם וְאַרְבָּעִים וַחֲמִשָּֽׁה׃ ס
The literal translation is "hundred two and forty and five."
Compare to the 7:68 (missing from most Hebrew manuscripts):
וּסֵיהֶם שְׁבַע מֵאוֹת שְׁלֹשִׁים וְשִׁשָּׁה ס פִּרְדֵיהֶם מָאתַיִם אַרְבָּעִים וַחֲמִשָּׁה ס
Literally this is "hundred two forty and five." If verse 68 is original to Nehemiah then the scribe was purposeful to record the total number of singers as different from the same number of mules which immediately follows.5 If this is the case, we can see the Nehemiah scribe was aware of the potential for confusion between the different number of singers due to the same number of mules and was purposeful to record those two differently despite being numerically the same.
1. Hindy Najman, The Jewish Study Bible, Oxford University Press, 2004, p. 1672
2. While this question is only over the number of singers, the other differences must be acknowledged and a plausible explanation for the variance between singers should be consistent with or encompass an explanation of the other variances.
3. A city official or "gate keeper" could report anyone who arrived in the city after the census was started and the census taker would verify whether they had already included that person in an earlier count at a different city.
4. Unlike a variance between cities/ancestries this variance may not impact the census total.
5. The manuscripts missing verse 68, have 245 singers, which in light of verse 68, is an additional piece of textual evidence 245 is original to Nehemiah as there is no "and forty and five" to be found in Ezra. It is simply "forty and five," "and forty and five" is unique to Nehemiah 7:67.
I think the answer is much more simple.
Read the beginning of the narrative:
Nehemiah 7:5b “… I found the genealogical record of those who had been the first to return. This is what I found written there: …”
Nehemiah is not making a ‘thus sayeth the Lord’ count. He is reading from a document he found. He makes no claims or confirmations of what he read. He simply gives us what he read.
God’s word accurately gives us exactly what the document Nehemiah found says. There is no requirement that is match up with the correct numbers found in Ezra.
Additionally, the context tells us that whereas Ezra’s register was made up before the migration to Jerusalem while still in Babylon (in the 450s bc), Nehemiah’s register was drawn up some years later after the journey to Judea and rebuilding (around 445bc).
I wouldn't expect them to be exact.