Date: 201408
Local time of day: 1801-2400
Location: ZOA.ARTCC, CA
Flight conditions: VMC
Light: Night
Aircraft: B737-700
Operator: Air Carrier
Operating under: Part 121
Flight plan: IFR
Flight phase: Descent
Airspace: Class A ZOA
ATC / advisory: Center ZOA
Reporter organization: Air Carrier
Reporter function: Captain
Reporter qualification: Flight Crew Air Transport Pilot (ATP)
Second reporter function: Pilot Not Flying; First Officer
Anomaly: ATC Issue All Types; Conflict Airborne Conflict; Deviation / Discrepancy - Procedural Published Material / Policy
Detector: Automation Aircraft RA; Automation Aircraft TA; Person Flight Crew
When detected: In-flight
Result: Air Traffic Control Issued New Clearance; Flight Crew FLC complied w / Automation / Advisory; Flight Crew Took Evasive Action
Contributing factors: Airspace Structure; Procedure
Primary problem: Ambiguous

Narrative: We were vectored off the MODESTO 5 Arrival into SFO for spacing. The vector was to the left of course. As we were descending through FL210 for FL200; Approach called out one o'clock traffic below. The traffic was climbing and courses were converging. My First Officer; pilot monitoring;  saw the traffic right as we received the resolution advisory (RA) to climb. He was 900 feet below us. The other traffic told ATC that he was responding to the RA and descending. The radio was congested and we told him we were responding to an RA as soon as we could as well. The instructions from ATC were opposite of what the RA was telling us to do vertically. He then gave us instructions to turn toward the other aircraft from a 210 heading to a 270 heading; which we elected not to do until we were clear of conflict. We complied with the RA and eventually leveled at FL220 before we got clear of the conflict. We then turned to a 290 heading and then a 310 heading per ATC's instructions and resumed our descent to FL200. This all happened very quickly.


Second narrative: As we were descending through FL210 for FL200 Approach called out first one traffic at about three o'clock and then traffic at about 1 o'clock below (I believe.) I spotted the three o'clock traffic [as it] passing behind us and no factor. Just as I adjusted my sight to the one o'clock traffic and spotted it; our aircraft received a 'Traffic; Traffic' traffic advisory. As I then transitioned to the ND DU; the warning transitioned to a 'Climb; Climb' RA and the PFD displayed the appropriate symbology for a climb prompt.Just as I was about to key the MIC and transmit our TCAS alert maneuver to ATC; the other participating aircraft called ATC and announced he was responding to a TCAS alert and was descending. ATC interjected that we were descending and informed the other traffic that they should be climbing. This exchange took place twice; I believe; before the ATC frequency was clear enough for me to transmit we were responding to a TCAS alert and climbing. The instructions from ATC were opposite of what the RA was telling us to do vertically.


Synopsis: A B737-700 inbound to SFO; descending on the MODESTO 5 STAR to FL200 received and responded to TA and RA warnings with respect to opposite direction climbing traffic. While doing so they refused contradictory flight path corrections provided by ATC.