Spanish has two series of phonemical stops: voiceless /p t k/ and voiced /b d g/ (for their orthographical representation, see final note).*
Spanish voiceless stops are, phonetically, always unaspirated voiceless stops: [p t k]. The voiced stops, however, are commonly realized phonetically as voiced approximants or fricatives: [β ð ɣ]. This is a kind of lenition (meaning "weakening, softening", from Latin lenis weak"). They only appear as stops after a pause (such as in the beginning of a phrase) or a nasal consonant.
So in most cases the main phonetical clue that distinguishes (phonemical) voiceless from voiced stops, in Spanish, is the presence or absence of lenition.
English voiceless stops are aspirated ([pʰ tʰ kʰ]) word-initially and syllable-initially in stressed syllables. English voiced stops are phonetically only partially voiced, but they are definitely realized as stops (they don't experience lenition).
So for English speakers the main phonetical clue when contrasting voiceless and voiced stops is the presence or absence of aspiration.
Summarizing, this is distribution of phonetical stops in Spanish and English:
SPANISH | ENGLISH
p t k | pʰ tʰ kʰ
| p t k
β ð ɣ | b d g
b d g |
Spanish /p t k/ are like English /p t k/ in spot, steam, sky. Spanish intervocalic /d/ is close to English /ð/ in this, those. Spanish /b d g/ after pause or nasal consonant are mostly as in English.
Spanish speakers learn to "tune in" to certain phonetic distinctions and ignore others. Most Spanish speakers wouldn't believe the two d's in dedo are not the same sound, just as most English speakers wouldn't believe the two p's in paper are different.
In rapid speech, or with too much ambient noise, or in an otherwise non-optimal setting, Spanish speakers might confuse /p/ and /b/ or /t/ and /d/ or /k/ and /g/, but in most cases (as in every other language, since the setting is rarely optimal) context is enough to avoid the confusion.
As with any new language, one must learn to discern these contrasts and "tune out" the ones found in one's own language that interfere.
* Orthography: The sounds /p t d/ are always represented as p, t, d; /b/ is commonly b or v (there's no difference, repeat, no difference in Spanish between those, no matter what other people tell you!); /k/ is usually c before a, o, u and qu before e, i, except in a few borrowings that employ k, and /g/ is g before a, o, u, ü and gu before e, i.