In the preceding and following verses, Paul talks about something 'written with ink', '[written] on tablets of stone', 'the letter', 'the ministry of death, carved on tablets of stone', 'the ministry of condemnation', and 'the old covenant / Moses' which has a 'veil'.
These are all in contrast to '[written] with the spirit of the living God', '[written] on tablets of human hearts', 'the new covenant', 'the spirit', 'the ministry of the spirit', 'the ministry of righteousness', and 'Jesus' who removes that 'veil'.
Contextually, it looks like when Paul speaks of 'the letter' in contrast to 'the spirit', he is talking about 'the Law' as a whole; not the books of the Hebrew scriptures, not the ten commandments, not the ceremonial commandments, but the entire 'old covenant' system. This is reinforced by his connection of the 'new covenant' in verse 6 with writing on 'human hearts' in verse 3. This is an obvious reference to Jeremiah 31, where God says he will make a 'new covenant' that is unlike the (old) covenant he made with Israel during the exodus.
He nuances it differently per epistle, but what Paul says in 2 Corinthians 3 is comparable to what he writes in Romans 7-8, or Galatians 3-5. The Law (though not evil) brings condemnation of death on those who sin, but Jesus brings life through the spirit. The old covenant, and the new covenant. These three passages have a noticeable overlap in content: death from the Law, life from the spirit/faith/Jesus, being heirs with Jesus, and a glory to be revealed/unveiled.